47 bytes, counting the shebang and two LFs; 26 bytes for the one-line script by itself. And it gives with the correct answer, too (48 "words" for the input text in question).#!/usr/bin/perl -ln $t+=@a=/\w+/g;END{print$t}
In reply to Re^2: word count
by graff
in thread word count
by targetsmart
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |