[plug] [OT] Perl Sub Modify Global Variable
Mark O'Shea
mark at musicalstoat.co.uk
Wed Feb 9 11:45:42 WST 2005
On Wed, 2005-02-09 at 11:01 +0800, Timothy White wrote:
> Once again. I hate perldoc and Google isn't helping.
>
If you want to learn about perl I would grow to love perldoc if I were
you. It's a great resource, it would be a shame to ignore it.
Strange that google isn't working for you. I did a searches for:
perl global variable
&
perl variable scope
and got lots of good pages.
Also try:
perldoc -q scope
perldoc -f our
Note you can also use $::var to read a global variable for the main
package. $Package::var, will address variables in other packages.
> I wish to modify global variables in an array and not modify a copy of
> the global variable. I don't really want to have to return the variables
> especially as some of the subs are called from multiple subs at an
> unknown nested depth.
>
I would be careful with this. It might be a lot cleaner to pass these
variables around and return results rather than trying to use globals.
But that's up to you to decide.
I hope this helps.
--
Mark O'Shea
More information about the plug
mailing list