in reply to How to count the total number of times the word 'the' and 'and' occur in 5 files i selected?
while(<>) { # loop thru all file arguments' lines for (split) { # split line on default separator (' ') $occ{$_}++; # increment counter for each word } } print $occ{'and'}+$occ{'the'}; # add occurrences
I haven't actually checked if th
|
|---|