%h = map { $_ => $h{$_} } @to_keep;
is the same as
%h = @h{@to_keep};
Update: Oops, no! It would actually be equivalent to the more complicated:
my %temp; @temp{@to_keep} = @h{@to_keep}; %h = %temp;
In reply to Re^2: Hash assignments using map
by ikegami
in thread Hash assignments using map
by njcodewarrior
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |