in reply to Hash slice again
undef @a{@a};# there is no hash you probably want something like this:@a = (a,b,c); undef @a[1,2]; @a = (a,b,c);
Be well,@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' ];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hash slice again (NOT)
by ikegami (Patriarch) on Jan 28, 2009 at 21:54 UTC |