>perl -wMstrict -le "my ($patterns) = map qr{$_}xms, join ' | ', qw(catalina\.properties \.key$ tomcat-users\.xml) ; ;; print $patterns; ;; my $string = 'foo.key'; print 'match' if $string =~ $patterns; " (?msx-i:catalina\.properties | \.key$ | tomcat-users\.xml) match