Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Help! My variables are jumping off a cliff!

by dave_the_m (Monsignor)
on Feb 26, 2012 at 08:40 UTC ( [id://956230]=note: print w/replies, xml ) Need Help??


in reply to Help! My variables are jumping off a cliff!

Note also that the two declarations introduce two separate variables that are in scope in different parts of the block; i.e. the second declaration isn't a NOOP:
my $x = 1; sub f1 { $x } my $x = 2; sub f2 { $x } print f1(), f2(), "\n"; # prints "12"

Dave.

Log In?
Username:
Password:

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

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

    No recent polls found