use strict; my $s = <<"__end__"; hubba bubba __end__ print "matched 1\n" if $s =~ m/^hubba$ ^bubba$/smx; print "matched 2\n" if $s =~ m/^hubba$ \n ^bubba$/smx;