In your update, you are mixing up arrays and hashes.
You imply this code, which you should have shown to your helpful friends
use strict and
use warnings:
@a = (a,b,c);
undef @a[1,2];
@a = (a,b,c);
undef @a{@a};# there is no hash
you probably want something like this:
@array = ( 'a', 'b', 'c', 'd', 'e' );
%hash = ( a => 0, b => 1, c => 2, d => 3, e => 4 );
@indices = ( 2, 3);
@keys = ( 'c', 'd' );
undef @array[ @indices ]; # undefs value of/in @array[3]
undef @hash{ @keys }; # undefs value of/in $hash{d}
use Data::Dumper;
print Dumper \%hash;
print Dumper \@array;
__END__
$VAR1 = {
'e' => 4,
'c' => 2,
'a' => 0,
'b' => 1,
'd' => undef
};
$VAR1 = [
'a',
'b',
'c',
undef,
'e'
];
Be well,
rir