RE: Help with strict
by Brian Raven other posts by this author
Aug 27 2008 3:05AM messages near this date
Re: Help with strict
|
Re: Help with strict
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?
You have had some good answers, but the following article might help you
understand what is going on.
http://perl.plover.com/FAQs/Namespaces.html
I always get plenty of those errors in new code. They tell me where I
have forgotten a declaration, or more often, identify a typo. In short,
"use strict" helps me avoid some classes of bug.
HTH
--
Brian Raven
--------------------------------------------------------------------------------------------
---------------
This e-mail may contain confidential and/or privileged information. If you are not the inten
ded recipient or have received this e-mail in error, please advise the sender immediately by
reply e-mail and delete this message and any attachments without retaining a copy. Any unau
thorised copying, disclosure or distribution of the material in this e-mail is strictly forb
idden.
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
_______________________________________________
ActivePerl mailing list
ActivePerl@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Barry Brevik
Lyle
Brian Raven
Serguei Trouchelle
Bill Luebkert
|