Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: setting hash keys by array

by Felonious (Chaplain)
on Sep 10, 2002 at 14:46 UTC ( #196693=note: print w/ replies, xml ) Need Help??


in reply to setting hash keys by array

my @arr = qw(red green brown); my $hash; $hash = { $_ => $hash || 1 } for (reverse @arr);
-- O thievish Night, Why should'st thou, but for some felonious end, In thy dark lantern thus close up the stars? --Milton


Comment on Re: setting hash keys by array
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2015-07-08 07:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (96 votes), past polls