in reply to Processing words in a file.
I guess you need first word of each line from the file
open FH, '<', "filename.txt" or die "Can not open file $!";
my ($first_word) = $_ =~ /^(\w+)/;
if ($first_word eq 'your string')
Once (shame on you!)
Twice (shame on me!)
More often than I'd like to be
All the time
Just when answering stupid polls
Who you callin' a fool?
I refuse to vote in this ridiculous poll
Results (435 votes). Check out past polls.