Artifact 96dad4e88b35e6b618575cd53f16a2fa63faa2c7:
- File tests/langbench/wc.pl — part of check-in [69b737f5a1] at 2016-04-19 20:35:49 on branch little — Fork of Tcl used in the "Little" project. http://www.mcvoy.com/lm/little/index.html (user: dgp, size: 340) [annotate] [blame] [check-ins using]
sub wordsplit { chomp($_[0]); @list = (); $word = ""; foreach $c (split(//, $_[0])) { if ($c =~ /\s/o) { push(@list, $word) if $word ne ""; $word = ""; } else { $word .= $c; } } push(@list, $word) if $word ne ""; return @list; } $n = 0; while (<>) { @words = &wordsplit($_); $n += $#words + 1; } printf "%d\n", $n;