Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Hash assignments using map

by johngg (Canon)
on Feb 24, 2007 at 18:16 UTC ( [id://601900]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @keys = qw{a b c d};
    my %hash = map { $_ => 1 } @keys;
    
  2. or download this
    my @keys = qw{a b c d};
    my %hash;
    $hash{$_} ++ for @keys;
    
  3. or download this
    my @keys = qw{a b c d};
    my %hash;
    @hash{@keys} = (1) x scalar @keys;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (1)
As of 2024-04-24 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found