Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Are global variables "bad"?

by jettero (Monsignor)
on Apr 21, 2009 at 16:39 UTC ( [id://759052]=note: print w/replies, xml ) Need Help??


in reply to Are global variables "bad"?

Globals are a pretty common thing in modules. There's a lot of really good reasons to use package globals and package namespace globals. If your script is just a collection of functions, then they're acting a bit like a module called "main."

On one extreme, you end up passing the same (essentially) global data from function to function, just to avoid a global variable ... on the other extreme, every variable in the program is global. Extremes can be bad. Global variables aren't necessarily bad.

-Paul

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-03-29 06:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found