http://www.perlmonks.org?node_id=435789


in reply to Re^4: Perl Idioms Explained - keys %{{map{$_=>1}@list}}
in thread Perl Idioms Explained - keys %{{map{$_=>1}@list}}

That is, taking "undef EXPR" as (usually) equivalent to "EXPR = undef", the behavior is sensible, even expected.
But that isn't what it does.
my @ar = (1..10); undef @ar[0..5]; print "@ar\n"; # 1 2 3 4 5 7 8 9 10 @ar[0..5] = undef; print "@ar\n"; # 7 8 9 10
The former interprets the slice as a scalar list, and undefs the last element only. The reason all the keys get defined is that it puts the slice in lvalue context, and autovivification occurs. The latter is equivalent to assigning a list to a list.

Caution: Contents may have been coded under pressure.