Re: Syntax error

From: Martin L. (mjpliv_at_eastlink.ca)
Date: 03/30/04


Date: Tue, 30 Mar 2004 16:24:38 GMT

ko wrote:

>
> Not sure exactly why you got those errors, did a copy/paste and got
> different ones. Did you copy/paste in your post, or type it?
>
> So I didn't go through the whole script, but a cursory inspection
> revealed a couple of problems. Hopefully the corrections will help
> get you started. After corrected it passed syntax checks (-c switch),
> assuming 'use strict' and 'use warnings'. Maybe that's the reason you
> got the different error messages - you should always start your
> scripts with:
>
> use strict;
> use warnings;
>
> [snip code]
>
>
> The way you have the code formatted is very hard to read. Issue a
> 'perldoc perlstyle' from your shell for some guidelines to make your
> scripts easier to read/maintain.
>
> HTH - keith

Thanks for the response!
Nice catch on the capital "I"- I would have looked for that one a long
time before seeing it. (and the other typo).

Book I am learning from does not show the "use strict" or "use
warnings" lines in external .lib files. Normally i would use the "use
strict" in all my scripts. I added both to the problem script,
corrected the typo's and I got an error to the effect that it could not
find the files required for "use warnings". I removed it and everything
runs fine now. Thanks for the input.

Do you have a URL for a site that discusses perl formating norms to
make my script more readable. I have yet to be able to get my resident
copy of perl to spit out anything.

Thanks
Martin L.



Relevant Pages

  • Re: A script to flag commonly misused words
    ... is preferable in general as it allows you to scope warnings. ... use strict; ... I first wrote a script to extract the words to flag from your ... I discovered that at least one of the expressions you ...
    (comp.lang.perl.misc)
  • Re: [PATCH] Speed up "make headers_*"
    ... 'use strict' and 'use warnings' is recommended. ... The parentheses are not needed for most of the built-in functions. ... More or less the same comments would apply to the next script as well. ...
    (Linux-Kernel)
  • Re: Regular Expression and file editing.
    ... Goksie wrote: ... If i run the script, the changes could not be effected bcos the files is ... use warnings; ... use strict; ...
    (perl.beginners)
  • Re: Pipe input over several scripts
    ... The problem is that script c is not getting the input. ... use strict; ... use warnings; ... buffer where script_c can get it. ...
    (comp.lang.perl.misc)
  • Re: Counting column delimiters per row in a text file
    ... Then parse (see the parse method) ... This can't be more than 20 lines or so including use strict and use ... Put the data in the __DATA__ section of your script. ... use warnings; ...
    (comp.lang.perl.misc)