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; }
In reply to Re: matching elements in a list in a logical OR fashion
by parv
in thread matching elements in a list in a logical OR fashion
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |