in reply to matching elements in a list in a logical OR fashion
I have something like the following in one of my own modules ...
print match_one( "string" , [ qw/character word paragraph string/ ] ) ? "matched" : "no match" ; sub match_one { my ($string , $list) = @_; foreach ( @{$list} ) { return 1 if $string =~ m/$_/; } return; }
|
---|