Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: declare/initialize variables at bottom of script?

by dcmertens (Beadle)
on Jun 11, 2013 at 21:31 UTC ( #1038346=note: print w/ replies, xml ) Need Help??


in reply to declare/initialize variables at bottom of script?

If you're willing to foregoe strictness (not recommended), you could use globals and a BEGIN block:

no strict; no warnings; some_operation_on($abc); ... BEGIN { $abc = 'foo'; }
If you want to keep strictness, you have to declare them before their first use. Again, you could employ the BEGIN bock trick to assign their initial values at the end of the script.


Comment on Re: declare/initialize variables at bottom of script?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2014-07-29 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (211 votes), past polls