Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: On-the-fly hashref

by moritz (Cardinal)
on Sep 28, 2010 at 16:52 UTC ( [id://862470]=note: print w/replies, xml ) Need Help??


in reply to On-the-fly hashref

my $x = { map {; $_ + 1 => (qw/Jan Feb Mar/)[$_] } 0 .. 2 }

Perl 6 solution:

my $x = hash <Jan Feb Mar ...> Z 1..12;

You can emulate that in Perl 5 with the zip() function from List::MoreUtils

Perl 6 - links to (nearly) everything that is Perl 6.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-05-18 17:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found