my %big_hash = (...); my @to_keep = ('abc', 'xyz'); %big_hash = map { exists($big_hash{$_}) ? ($_ => $big_hash{$_}) : () } + @to_keep; # or %big_hash = map { $_ => $big_hash{$_} } grep { exists $big_hash{$_} } +@to_keep;
In reply to Re^3: Hash assignments using map
by japhy
in thread Hash assignments using map
by njcodewarrior
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |