Does anyone know an elegant way to write this?
Perhaps?
my %small_hash; my @retain = grep{ defined $config{ $_ } && $config{ $_ } ## not false } @interesting_keys; @small_hash{ @retain } = @config{ @retain }; return \%small_hash;
In reply to Re: Taking a subset of a hash
by BrowserUk
in thread [Answered!] Taking a subset of a hash
by Narveson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |