Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Re: Unusual Closure Behaviour

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


in reply to Re: Unusual Closure Behaviour
in thread Unusual Closure Behaviour

Hi I think this clarifies the situation. $x is definitely lexically scoped. Run this as in then uncomment the use strict.

# use strict; sub foo { my $x if 0; return ++$x; } for (1..7){ print foo(); print "($x)"; };
cheers

tachyon

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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://96269]
help
Chatterbox?
[Lady_Aleena]: Taking the printing functionality out of a module is hard at times. The one I'm currently working on has conditionals and loops for the data to be printed.
[Lady_Aleena]: Some are as easy as returning instead of printing, but only some.

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2017-05-29 02:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?