Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: each on reference is experimental take 2

by Mr. Muskrat (Canon)
on Mar 10, 2016 at 19:47 UTC ( [id://1157342]=note: print w/replies, xml ) Need Help??


in reply to each on reference is experimental take 2

Strangely, when using each %{ $hoh->{ $sid } } I get the error

That's because you are trying to access the non-existent hashref $hoh instead of the existing hash %hoh.

# Hash, this is what you have my %hoh = ( ... ); # walk each key/value pair contained in the hash reference stored in $ +hoh{$sid} while ( my ( $key, $value ) = each %{ $hoh{$sid} } ) { ... } # Hash reference, what generated the error my $hoh = { ... }; # walk each key/value pair contained in the hash reference stored in $ +hoh->{$sid} while ( my ( $key, $value ) = each %{ $hoh->{$sid} } ) { ... }

Replies are listed 'Best First'.
Re^2: each on reference is experimental take 2
by natxo (Scribe) on Mar 10, 2016 at 20:08 UTC
    aha, thanks for your explanation, I think I got it.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-03-29 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found