in reply to Re: Should code that does not use strict even be considered here?
in thread Should code that does not use strict even be considered here?
It isn't. And only the programmer who just past the novice stage himself will think so.
"use strict" can aid you to write good programs. But it isn't a goal in itself. And just patching your program so it satisfies "use strict" may improve your code a little bit, but it's a far cry from good programming.
Say, for instance, someone posts a code fragment that uses, inside an if statement inside a sub something like:
where $thingybob is only used inside the foreach. The typical grasshoppers Pavlov reaction will be "I've no idea how to solve your problem, but you should use strict". So, the OP slaps "use strict" on his program, notices the compile failure, remembers to declare all the variable, and puts "my $thingybob;" right below the "use strict" on top of his program. Hooray! Code now compiles under "use strict". Did his code actually increase in quality? No. In fact, I'd consider his code of less quality.foreach $thingybob (@thingybobs) { ... }
Good advice (but still likely to not be relevant to his problem) would have been to tell him about narrow scopes. Writing
is what you want to see if you want better code. And that's the advice (if you insist on giving non-problem related advice) you should give.foreach my $thingybob (@thingybobs) { ... }
Don't focus on a possible tool. Focus on the goal.
|
---|