Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Slicing and Destructing a Hash

by Enlil (Parson)
on Sep 02, 2005 at 03:32 UTC ( [id://488541]=note: print w/replies, xml ) Need Help??


in reply to Slicing and Destructing a Hash

Something like so?
use warnings; use strict; use Data::Dumper; my %hash = (a => 3, b=> 4, c =>1 ,d=>7); my @sel = qw(b c); my %nhash; @nhash{@sel} = delete @hash{@sel}; print Dumper \%hash; print Dumper \%nhash; __END__ $VAR1 = { 'a' => 3, 'd' => 7 }; $VAR1 = { 'c' => 1, 'b' => 4 };

-enlil

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://488541]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-03-28 10:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found