which is fancy-looking, non-map-in-a-void-context way of saying:my %hash2; map { $hash2{$_} = $hash{$_} if /^NETWORK/ } keys %hash;
My rough check with Benchmark shows no difference between map...grep and map alone until the hash sizes were increased to force memory paging to disk.my %hash2; { $hash2{$_} = $hash{$_} if /^NETWORK/ } foreach keys %hash;
[I didn't check to see if anything was optimized away.]
-QM
--
Quantum Mechanics: The dreams stuff is made of
In reply to Re: Re: Hash slices
by QM
in thread Hash slices
by Marcello
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |