# use like this: %pets = hash_slice( \%hash, qw( dog cat ) );
For once, this may be a situation in which using a prototype would not be that bad:
sub hash_slice (\%@) { my $h=shift; map { $_ => $h->{$_} } @_; }
(Or the other way with slices. I don't really care.)
In reply to Re: How to extract part of a hash
by blazar
in thread How to extract part of a hash
by rhesa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |