Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Closure question

by broquaint (Abbot)
on Mar 02, 2004 at 17:44 UTC ( [id://333314]=note: print w/replies, xml ) Need Help??


in reply to Closure question

This is the nature of the execution flow of perl - my @r hasn't been 'executed' yet, so you'll want something along the lines of a BEGIN block if you want it to be initialized and have it after the subroutine call e.g
foo(); BEGIN { my $str = 'a string'; sub foo { print "\$str is $str\n" } } __output__ $str is a string
HTH

_________
broquaint

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-26 06:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found