in reply to Matching a long list of phrases

A hash or constant would be eficient and reasonably easy to maintain
use constant PHRASE => { 'phrase one' => 1, 'phrase two' => 1, 'a different phrase' => 1, 'yet another match' => 1, 'one more to match' => 1, 'single' => 1, 'word' => 1, }; if ( PHRASE->{$incoming{'text'}} ) { #DO WHAT NEEDS TO BE DONE HERE }

Replies are listed 'Best First'.
Re^2: Matching a long list of phrases
by Sartak (Hermit) on Aug 14, 2006 at 17:40 UTC
    The problem with this approach is that the incoming text may have extra text. Say one of the phrases was "Perl hacker". The OP wants to match "Just another Perl hacker," with the phrase "Perl hacker"