in reply to Accidentally creating hash elements with grep { defined } on a hash slice
Very interesting. The issue doesn't deal with defined. That can be checked by the following:
my @keys = qw(foo bar baz); my %h; grep '', @h{@keys}; # creates keys 1 for @h{@keys}; # creates keys map '', @h{@keys}; # creates keys my @a = @h{@keys}; # DOESN'T create keys sort {$a <=> $b} @h{@keys}; # DOESN'T create keys
I think it depends on creating a list for iterations
|
|---|