Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Dereferencing a Hash of Arrays

by toro (Beadle)
on Jun 14, 2011 at 07:30 UTC ( [id://909546]=note: print w/replies, xml ) Need Help??


in reply to Re: Dereferencing a Hash of Arrays
in thread Dereferencing a Hash of Arrays

input:

my @atags = qw( 1 2 3 4 ); my @btags = qw( 9 8 7 6 ); my %alphabet = ( 'a' => \@atags, 'b' => \@btags, ); say for @{values %alphabet};

output:

Can't use string ("2") as an ARRAY ref while "strict refs" in use at ./concat.pl line 9 (#1) (F) Only hard references are allowed by "strict refs". Symbolic references are disallowed. See perlref. Uncaught exception from user code: Can't use string ("2") as an ARRAY ref while "strict refs" in use +at ./concat.pl line 9. at ./concat.pl line 9

Replies are listed 'Best First'.
Re^3: Dereferencing a Hash of Arrays
by chromatic (Archbishop) on Jun 14, 2011 at 17:47 UTC

    From perldoc values:

    (In a scalar context, returns the number of values.)

    You'll see the error to which I alluded if you print the keys of the hash.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-25 14:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found