|Welcome to the Monastery|
Re: Help needed understanding global variables in Perlby Sinister (Friar)
|on Mar 05, 2002 at 09:12 UTC||Need Help??|
Would actualy print " world", since $foo is routine scope and $bar is lexical scope.
Defining a global variable would require you to do: my $foo in the main scope of a 'package'.
This will actualy print "hello world" - which would have worked perfectly if you had choosen to do my $bar = ""; instead of our.
Now to get back on the difference between our and use vars
NOTE: The functionality provided by this pragma has been
superseded by "our" declarations, available in Perl v5.6.0
or later. See the our entry in the perlfunc manpage.
These lines come directly from the documentation of vars itself.
I hope this has answered some of your questions.
"Field experience is something you don't get until just after you need it."