in reply to Perl - 'count word'
If you want to look in other folders or just want a little more control over what's going on, it may be useful to look into the builtin opendir and readdir functions or even move up to the File::Find or Find::File::Rule modules.
For counting lines, there's clearly more than one way to do it, but a simple while(<F>){$words += split;} over each file gets it done (with a well placed my $words to count per file or cumulatively). I may get trashed for this last bit of sloppy code but it's a beginning.
Update: I should learn to type faster. Didn't see that two similar answers showed up while chicken-scratching my own.
|
|---|