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!