note
amir_e_a
<p>~~, the Smatch Match Operator introduced in Perl 5.10 and already mentioned by JavaFan is probably the best thing for you. See <a href="http://perldoc.perl.org/perlsyn.html#Smart-matching-in-detail">Smart matching in detail</a> in the Perl documentation for more details.</p>
<p>It only works in Perl 5.10 and later. If you are using an earlier version, you should consider upgrading.</p>
<p>If you can't upgrade, grep and the functions in List::Util and List::MoreUtil may do what you need. Note that grep has a performance price, as it always goes over the entire list, but on small lists it's not significant.</p>
814588
814588