in reply to mixed case with match
Relevant to the functionality but not to the OP's question:
Built-in variable $. is the number of lines read from the current (i.e. last-read) file handle. So:
while ( <> ) { last if m/perl/i; } print "There were $. lines until I found perl\n";
In Section
Seekers of Perl Wisdom