RosettaCodeData/Task/String-matching/Perl/string-matching-1.pl

4 lines
166 B
Perl
Raw Permalink Normal View History

2015-02-20 09:02:09 -05:00
$str1 =~ /^\Q$str2\E/ # true if $str1 starts with $str2
$str1 =~ /\Q$str2\E/ # true if $str1 contains $str2
$str1 =~ /\Q$str2\E$/ # true if $str1 ends with $str2