Hi all,

let's we have:

use strict;
use warnings;

my @input = qw{ one two twentythree four };
my @filter = qw { one three five ten twenty };


my @filtered = ();
for my $in (@input) {
    for my $filter (@filter) {
        push @filtered, $in if $in =~ /$filter$/i;
    }
}

I'd like to get new @filtered array, where will be only values
from @input against @filter.

but my snippet is 6 lines, I think it should be written in 1 line, with
using grep and map, but I'm not sure how.

Also we can say, input is always smaller than @filter (for
optimalization)

Anyone ?  :)




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to