well - since you use #!/usr/bin/perl you probably have wc at your fingertips. wc -w <file> could do what you want. You could just backtick it in your perl script. But then again this wouldn't be portable.
Then, there is CPAN. String::ParseWords could be interesting. Or look there! wc in a portable manner!
For a simple task all this may seem good enough. But when it comes to real word counting you first need to tokenize your text. Tokenizing is an art for itself. Have a look at This Book if you're really into it. And don't forget to make it unicode safe. :-)
Bye
PetaMem
In reply to Re: Counting words
by PetaMem
in thread Counting words
by raveguy2k
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |