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

Re: Dereferencing a Hash of Arrays

by stefbv (Curate)
on Jun 14, 2011 at 07:00 UTC ( [id://909532]=note: print w/replies, xml ) Need Help??


in reply to Dereferencing a Hash of Arrays

Values returns an array.

The values function returns a list.

say for values %alphabet;

Updated as jwkrahn suggested, thanks.

Replies are listed 'Best First'.
Re^2: Dereferencing a Hash of Arrays
by jwkrahn (Abbot) on Jun 14, 2011 at 07:16 UTC
      Yes, I should 'use strict' when explaining about Perl functions :)
Re^2: Dereferencing a Hash of Arrays
by toro (Beadle) on Jun 14, 2011 at 07:09 UTC
    Well, it returns two arrays. How do I get the program to spit out [1, 2, 3, 4]; [9, 8, 7, 6] ?
      Only one :), with 2 array refs. (AoA)
      say "@$_" for values %alphabet;
        Thanks stefby, that works. But I don't understand why. Where does $_ derive from in this case, and why do I need ""?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-04-19 08:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found