my @regexes = map qr/$_/, ('hello(\w+)', 'HELLO(\w+)', Hello(\w+)'); for my $re (@regexes) { if ($string =~ $re) { print "$string matched $re\n"; } }