Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: DIFFERENCE BETWEEN VARIABLE

by autark (Friar)
on Jan 31, 2001 at 18:36 UTC ( [id://55472]=note: print w/replies, xml ) Need Help??


in reply to DIFFERENCE BETWEEN VARIABLE

Actually, there is a difference between $output and ${'output'}:
$output = "global"; { my $output = "my"; print $output; print ${'output'}; }
This little example will first print out "my" then "global". This is because the latter is a symbolic reference to the $output variable - hence it will always refer to the global variable (which is stored in the package stash).

${output} on the other hand is not a symbolic reference, and will still refer to the lexical variable (if one exists).

Autark.

Log In?
Username:
Password:

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

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

    No recent polls found