Barry Brevik wrote:
> I have seen it said many times, on this list, that we should always
> have:
>  
>   use strict;
>
> I have tried to use this many times, but all it does is give me hundreds
> of errors like this:
>  
>   Global symbol "$version" requires explicit package name at
> domainctrl.pl line 10.
>   Global symbol "%cmptrlist" requires explicit package name at
> domainctrl.pl line 18.
>
> All of these are variables created in the main body of the program... I
> suppose that they are technically part of the "main" package, but if
> strict is trying to tell me that I have to refer to these as
> main::$version (for example), I don't think that I am willing to go
> there.
>
> Can anyone tell me what is going on here?
>   

It's saying that these variables haven't been defined. E.g. they haven't 
been declared local variables with 'my' such as
my $version;
Or you haven't declared them as Global with 'our' such as
our $version;
Note that 'our' is only in Perl 5.8 and up. Previously Globals had to be 
declared with use vars, such as
use vars qw( $version );
You can still 'use vars' post Perl 5.8, some people prefer it to 'our' 
and it's good for backwards compatibility (and keeping all your globals 
listed in one place)


Lyle
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to