in reply to Mathching an array in regex
use List::Util qw(first); my @arr=('cool','guy','here'); my $str1="I am cool"; my $hit = first{ $str1 =~ /\Q$_/ } @arr; print "Matched $hit"; [download]