my $pattern = qr{^/(?:data|tmp)\w+$}i; # ... elsif ( $fs =~ $pattern ) { print "YIKES, my mother-in-law is here\n"; }