@regexps = qw( foo bar baz ); @strings = qw( abc def ghi ); for $regexp (@regexps) { # All I did was reverse for $string (@strings) { # these two lines. $string =~ /$regexp/ } }