neversaint has asked for the wisdom of the Perl Monks concerning the following question:
So that finally the original %hash becomes:perl -MData::Dumper -e ' %hash = (a => 3, b=> 4, c=>1 ,d=>7); @sel = qw(b c); @nhash{@sel} = @hash{@sel}; print Dumper \%hash;'
Is there a quick way to do it?$VAR1 = { 'a' => 3, 'd' => 7 };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Slicing and Destructing a Hash
by Enlil (Parson) on Sep 02, 2005 at 03:32 UTC | |
|
Re: Slicing and Destructing a Hash
by xdg (Monsignor) on Sep 02, 2005 at 03:35 UTC | |
|
Re: Slicing and Destructing a Hash
by pg (Canon) on Sep 02, 2005 at 03:29 UTC |