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