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


in reply to Clearing Array Values

this is a very iffy subject i couldn't find clear documentation on with examples. from the documentation i've read on undef(), doing this:
UPDATE on the following code
undef @array; #@array undefined undef $scalar; #$scalar will be undefined
will clear those datatypes.. whereas
@array[2] = undef; #pick element number to undefine $scalar = undef; #$scalar will exist, but with no value
would assign undefined values to the datatypes. The biggest use for this would be assigning $variables to some array elements.. ie:
($value1,undef,undef,$value2,$value3,undef) = @array;
(thank you crazyinsomniac)