use strict; use warnings; use Data::Dumper; my @a = qw/a b c d/; my @b = qw/a b c d/; my %a; print '--- my @a before ---',"\n", Dumper \@a; undef @a[1,2]; print '--- my @a after ---',"\n", Dumper \@a; print '--- my %a before ---',"\n", Dumper \%a; undef @a{@b}; print '--- my %a after ---',"\n", Dumper \%a; #### --- my @a before --- $VAR1 = [ 'a', 'b', 'c', 'd' ]; --- my @a after --- $VAR1 = [ 'a', 'b', undef, 'd' ]; --- my %a before --- $VAR1 = {}; --- my %a after --- $VAR1 = { 'c' => undef, 'a' => undef, 'b' => undef, 'd' => undef }; #### if @a = (1,2,3), then undef @a[1,2] is proper, undefines $a[2] just undef @b[2], is giving me @b's 0 ,1 and 2 indexes to be undef. if %hash = qw(a b c d) then undef @hash{qw(a c)} is proper, undefines only $hash{c} just undef @hash1{qw(a c}} is giving me the values of the keys a and c to be undef