friedo and
EvanCarroll are right that
index will probably be fastest. Still, I wanted to clarify that by using
=~, you're using a regex; that's exactly what the
=~ operator does. You can learn more about regular expressions in the
perlre(1) manpage included with Perl, in any good book on Perl (such as
Learning Perl or
Programming Perl), or in the O'Reilly book
Mastering Regular Expressions.