On Mon, 07 Jul 2008, Greg Aiken wrote:
> can anyone please explain why when I am in the subroutine, and I
> attempt to print a variable that's been declared and assigned a value
> in the main package - why I am unable to print the value of the main
> package's variable (despite that I am using the fully qualified
> variable name)?

You are using a lexical variable (declared with "my").  It does not
live inside any package, but just inside the lexical scope.

You can use "our" to declare package variables.  If you change "my $var"
to "our $var" then your script should run fine.

Cheers,
-Jan

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to