<?xml version="1.0" encoding="windows-1252"?>
<node id="435789" title="Re^5: Perl Idioms Explained - keys %{{map{$_=&gt;1}@list}}" created="2005-03-02 07:19:38" updated="2005-08-11 16:59:41">
<type id="11">
note</type>
<author id="300037">
Roy Johnson</author>
<data>
<field name="doctext">
&lt;blockquote&gt;That is, taking "undef EXPR" as (usually) equivalent to "EXPR = undef", the behavior is sensible, even expected.&lt;/blockquote&gt;
But that isn't what it does.
&lt;code&gt;
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
&lt;/code&gt;
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.
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-300037"&gt;
&lt;hr&gt;
&lt;small&gt;&lt;b&gt;Caution:&lt;/b&gt; Contents may have been coded under pressure.&lt;/small&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
280658</field>
<field name="parent_node">
435713</field>
</data>
</node>
