Pete:
What version of perl are you using? It sounds like you have a very
recent one. I have 5.6.0 from Activestate. The following program
yields two errors:
#!C:/perl/bin -w
use strict;
$var = "Hello world!";
print "$var\n";
The errors are the same as yours: Global symbol $var ... lines 3
and 4.
I gather that perl now requires explicit declaration of all variables.
To explicitly declare a global, declare "our $var" and it runs just fine.
Unfortunately this convention does not seem to be backwardly
compatible, as "our" is not recognized by earlier versions.
Hope this helps.
Skipper
On 6 Mar 2001, at 9:21, Peter Eisengrein wrote:
> After last week's conversation on use strict, I am making an effort to
> 'use strict'. I am having some difficulty understanding some of it,
> though. Hopefully someone can help.
>
> It is my understanding that if I declare a $var, an @array, or a %hash
> in the main part of the script that I should be able to use it in
> sub's; however, if I declare one by the same name within a sub that I
> then need to be explicit as to which one I mean.
>
> Am I understanding this right? Because when I attempt to use it this
> way, some of the declarations are ok but for some I get the error,
> "Global symbol "@array" requires explicit package name at ..."
>
> So my questions, I suppose, are [1] what am I doing wrong and [2] why
> does it work for some but not for others?
>
> Thx,
> Pete
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
>
Robert Boyd Skipper, Ph.D.
Assistant Professor of Philosophy
St. Mary's University
One Camino Santa Maria
San Antonio, Texas 78228-8572
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users