Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Reference curiosity?

by kvale (Monsignor)
on Apr 23, 2006 at 17:32 UTC ( #545138=note: print w/ replies, xml ) Need Help??


in reply to Reference curiosity?

In the first case, %hash is still in scope within the subrotuine, and so is still visible and is used in the print statement. In the second case, %hash has not been defined by the time the print statement occurs, so won't work.

Please note that $hash and %hash are different variables in perl. If you want to access hash element A with hash reference $hash, you would use $hash->{A}. See perlref for details.

Update: fixed a typo.

-Mark


Comment on Re: Reference curiosity?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2015-07-07 05:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls