Hello msh210,

I see no differences. I suppose use strict; use warnings; is with me since ever. It is also less cacophonic in sentences: use strict and warnings or...

If both are at the top of the program, again I see no differences. If you put a syntax error between them the error is the same:

io@COMP:C>cat sw.pl use strict; 0 use warnings; io@COMP:C>perl sw.pl "use" not allowed in expression at sw.pl line 5, at end of line syntax error at sw.pl line 5, near "use warnings" Execution of sw.pl aborted due to compilation errors. io@COMP:C>cat ws.pl use warnings; 0 use strict; io@COMP:C>perl ws.pl "use" not allowed in expression at ws.pl line 5, at end of line syntax error at ws.pl line 5, near "use strict" Execution of ws.pl aborted due to compilation errors.

Obviously strict can catch something and warnings too, but is a rare situation:

io@COMP:C>cat sw.pl use strict; $x=1; use warnings; io@COMP:C>perl sw.pl Global symbol "$x" requires explicit package name (did you forget to d +eclare "my $x"?) at sw.pl line 2. BEGIN not safe after errors--compilation aborted at sw.pl line 3. io@COMP:C>cat ws.pl use warnings; $x=1; use strict; io@COMP:C>perl ws.pl Name "main::x" used only once: possible typo at ws.pl line 2.

So I suppose it is a matter of taste.

The only important thing is to use them both everytime ;)

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

In reply to Re: use strict; before/after use warnings; by Discipulus
in thread use strict; before/after use warnings; by msh210

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.