Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: "A meditation on Hashes", or "Why i need more aspirin"

by jdhedden (Deacon)
on Jun 16, 2006 at 00:54 UTC ( [id://555668]=note: print w/replies, xml ) Need Help??


in reply to Re: "A meditation on Hashes", or "Why i need more aspirin"
in thread "A meditation on Hashes", or "Why i need more aspirin"

Checking for $hash{a}{b} causes $hash{a} to suddenly contain the reference to an anonymous hash that is checked for the 'b'.
And the exception to this is when using threads::shared:
Taking references to the elements of shared arrays and hashes does not autovivify the elements, and neither does slicing a shared array/hash over non-existent indices/keys autovivify the elements.
Thus, the following results in a runtime error:
use strict; use warnings; use threads; use threads::shared; my %hash :shared; print '$hash{a}{b} ', ( exists $hash{a}{b} ) ? "exists" : "doesn't ex +ist";

Remember: There's always one more bug.

Log In?
Username:
Password:

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

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

    No recent polls found