Actually, -w and use warnings are scoped differently. -w is dynamically scoped (i.e. it's a global), while use warnings is file/block scoped. In other words, -w affects modules, but use warnings only affects the file its in.
Indeed. The point being that since he has use warnings; anyway, he most probably doesn't want -w on the shebang line, leaving aside "scipt", for the moment. All in all that looked much like cargo cult to me...
for (<*.sql>) { # I never use C<foreach> ;-)
Why load the entire list into memory? Just use:
Oh, how many *.sql files can he have?!? But jokes apart, I second that: while is certainly better, well: until we'll have lazy evaluation!!
while (<*.sql>) { ...
In fact. Except that, as a minor note, you'd probably need to give it a name. And as an even minor note, to avoid confusion with the typical filehandle iterator idiom, I'd write an explicit glob there.
I use for for for loops (e.g. for (1..100)) and foreach for foreach loops (e.g. foreach (@array)). Using for unconditionally as you do is bad programming, since it affects the ability to read your program negatively.
I beg to differ: I find both quite as readable and synonims also in the psychological feeling they give. And I find for to be easier both to think of and to type. Using foreach would affect negatively readability for me and avoiding to use it IMHO doesn't severly injure it for others. As many other things in Perl, it's largely a matter of personal tastes; I wouldn't be so drastic about it. Of course I'm not trying or even thinking of imposing my own point of view, either. Period!

In reply to Re^3: if expression by blazar
in thread if expression by Win

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.