in reply to Matching a long list of phrases

As the Camel says, you should use /Gandalf/ || /Saruman/ || /Radagast/ over /Gandalf|Saruman|Radagast/ for efficiency.
my @phrases = map { qr/$_/ } # precompile regexes, may not be what you + want though ( 'phrase one', 'phrase two', 'a different phrase', 'yet another match', 'one more to match', 'single', 'word', 'matches', ); PHRASE: foreach my $phrase (@phrases) { last PHRASE if $incoming{'text'} =~ /($phrase)/; } if (defined $1) { # Matched phrase in $1. } else { # No match. }