in reply to Re: Fastest way to grep multiple time on some array
in thread Fastest way to grep multiple time on some array

or even
my %H; for my $item (@bigarray) { push @{$H{$1}}, $item if ($item =~ /(A|B|C)/); }


holli

When you're up to your ass in alligators, it's difficult to remember that your original purpose was to drain the swamp.

Replies are listed 'Best First'.
Re^3: Fastest way to grep multiple time on some array
by wol (Hermit) on Feb 19, 2009 at 17:45 UTC
    I think this would fail if one of the items in bigarray was "AB", as it would only add this item to $H{"A"} and not $H{"B"}.

    Alas we don't know for sure whether this would be a problem for the OP or not, but re-reading the post suggests maybe not.

    --
    use JAPH;
    print JAPH::asString();