XP is just a number | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
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 In reply to Is there a simple syntax to logically slice a hash? by misterperl
|
|