use List::Util 'all'; print "all\n" if all {$var =~ m/$_/} qw(x y z);