Perl syntax

John Wildberger wildberger-iRg7kjdsKiH3fQ9qLvQP4Q at public.gmane.org
Mon May 30 18:44:15 UTC 2005


On Monday 30 May 2005 12:02 pm, Andrew Hammond wrote:
> > I think I know the scoping issue. What confused me was the wording of the
> > error message:
> >  Global symbol "%count" requires explicit package name.
> > It would have been more meaningful if the error message would have said
> > something to the effect that the variables were not declared before they
> > were used.
>
> For friendlier messages, you might try
>
> use diagnostics;

With pragma 'use diagnostics' but without 'use strict' my program runs without 
errors, even if I have not declared my variables before I used them.
However, when using both pragmas I get a more friendlier error message as you 
have suggested.
Here is an excerpt:
.
.
Global symbol "$file" requires explicit package name at ./urc2_1.pl line 12.
Execution of ./urc2_1.pl aborted due to compilation errors (#1)
    (F) You've said "use strict vars", which indicates that all variables
    must either be lexically scoped (using "my"), declared beforehand using
    "our", or explicitly qualified to say which package the global variable
    is in (using "::").
John
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list