Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: Re: Need some help with a dodgy variable

by tachyon (Chancellor)
on Jul 31, 2001 at 17:06 UTC ( #101142=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Need some help with a dodgy variable
in thread Variable Scope

The only way to get the result you note is to call that_sub() before this_sub(). This prints "Hello Jeff" just fine

sub this_sub { $this_variable = "Jeff"; } sub that_sub { print "Hello "."$this_variable"; } this_sub(); that_sub(); # prints Hello Jeff

All I can presume is that your test case above is not the same as your real code as the test works exactly as expected. this_sub sets the global var $this_variable which is then available everwhere.

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


Comment on Re: Re: Re: Need some help with a dodgy variable
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2014-12-25 12:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (160 votes), past polls