in reply to Pattern Matching Query
my @matches = ( 'abcde', 'bcdef', 'cdefg', 'defgh', 'efghi', 'fghij', 'ghijk', 'hi +jkl', 'ijklm' ); if ( grep { $sorted_values eq $_ } @matches ) { # ... }
This approach makes for easy maintenence, particularly, if there a number of points in the code where matching is to be carried out. However, this method should prove to be slower compared to other methods in that it executes in O(n), where n is the number of elements in @matches.
YMMV
|
|---|