http://qs321.pair.com?node_id=1019960

misterperl has asked for the wisdom of the Perl Monks concerning the following question:

I want a slice from a hash, in one step?

examples: GIVE ME A HASH (from another hash) that only includes keys beginning with 'cat'. Or where the value is > 10. I usually resort to this sort of ugliness:

my %h2;
for ( keys %h )
{
next unless /^cat/;
$h2{$_} = $h{$_};
}


Seems like there oughta be other easier way to slice this thing up in one line with some sorta

@h2{@something} = @something++

TY Monks