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

Re^7: Warnings not being thrown with DBI (nits)

by tye (Sage)
on Sep 11, 2005 at 21:27 UTC ( [id://491109]=note: print w/replies, xml ) Need Help??


in reply to Re^6: Warnings not being thrown with DBI (nits)
in thread Warnings not being thrown with DBI

It isn't assigning to $href->{id}, it is assigning to a magic "alias" (at a distance) which autovivifies the key and value pair. I especially consider it autovivification because the assignment creates the key even though the key is not mentioned in the assignment code. I also consider it autovivification because it is just a special (delayed) case of the following:

To show the autovivification of a hash entry more clearly, just do \$hash{id} (using a hash entry in an lvalue 'context').

Or, to be closer to the original code, consider

for( $hash{id} ) { # ... } print keys %hash, $/;

Which hasn't (yet?) been made to delay the autovivification step like was done for function arguments.

- tye        

Log In?
Username:
Password:

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

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

    No recent polls found