$ perl -e '$a="A";$b="B";print "Matches!\n" if ($a.$b) =~ /A/' Matches! $ perl -e '$a="A";$b="B";print "Matches!\n" if ($a.$b) =~ /C/'