in reply to mixed case with match

Not all combinations of upper and lower case are valid. 'Perl' is the name of the language. 'perl' is the name of the interpreter. 'PERL' is used in some book titles. (e.g. PERL IN A NUTSHELL). Use alternation to test only for the valid forms.
last if m/\b(?:PERL|Perl|perl)\b/;
Bill