in reply to Counting words
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Counting words
by GrayMagiker (Initiate) on Apr 12, 2006 at 18:58 UTC |