if ($sentence =~ /foo/gis && $sentence =~ /bar/gis) { # do something further with $sentence } #### if ($sentence =~ /foo/gis) { if ($sentence =~ /bar/gis) { # now do something with the sentence } } #### if ($sentence =~ /foo/gis) { my $final_test = $sentence; if ($final_test =~ /bar/gis) { # *now* do something with the sentence... } }