Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

On-the-fly hashref

by oko1 (Deacon)
on Sep 28, 2010 at 16:39 UTC ( [id://862464]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @data = qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/;
    my %h;
    @h{1..12} = @data;
    my $x = \%h;
    
  2. or download this
    # This gets me a hash...
    my %x = map { $_ + 1 => (qw/Jan Feb .../)[$_] } 0 .. 11;
    
    # ...but this does not get me a hashref :-\
    my $x = \%{ map { $_ + 1 => (qw/Jan Feb .../)[$_] } 0 .. 11 };
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-05-28 07:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found