in reply to perl global vars in subroutines
Does anyone have suggestions on how to use global vars and perl modules.Yes, as a general rule: don't.
I realize I can pass the vars to the subs, or just keep the code in the script (via subs)That's the way to go!
I am using quite a few vars.Depending on how much 'quite' is, and what the subs do, it may be a sign you need a different breakdown in subs. Or that you need to pass around structures (hashes, arrays, objects, references...) instead.
the code is being re-used quite often.All the more reason to not use global variables to pass parameters around.
Abigail
|
|---|