Bryan Harris am Donnerstag, 23. Februar 2006 03.46:
> Thanks!
>
> Regarding your "note", out of curiosity, how will it help a lot in the end?
> I've been scripting for almost 5 years now, and have produced >100 scripts
> that are used in data analysis work by ~15 people, and have never used "use
> strict", nor declared any variables with "my".  Everybody says it's good
> coding practice, but I haven't yet figured out why...  Just wondering.
>
> Thanks again for your response.
>
> - Bryan
[...]
> > NOTE:  Always use strict and warnings.  It's much better to start now
> > than to have to change your habits later.  It's like learning to type;
> > at first it makes things slower, but in the end it will help a lot.
[...]

Hi Bryan

Sorry for stepping in (and my english - no offence intended)... 
Timothy's note is really good advice. Everybody on this list will give it. 
There must be a reason for that...

Of course one can use a keyboard with two fingers during years; but it's 
simpler using all ten :-)

Expecially 'use strict' provides some sort of "automated error detection" and 
thus more formal means to produce correct code; this is better than a 
more error prone "it seems to be correct"-like assumption.

When you code more than "little" scripts, when you create modules with 
reusable code in a bigger software project, it makes overview and maintenance 
*much* easier.

Just one example: When you declare your variables, you see at the first glance 
where it is declared, and if you see the variable somewhere without 'my', you 
know that it already has been (or should have been - if not, an error is 
produced) declared. 
Without 'my', you can't know that, but have to look into the whole code to 
find out if you are just declaring it at the position or using it: Your 
perspective, then, is less locally than possible.

Since you ask a question like that one in your original post after 5 years of 
scripting: Take his advice! 

Greetings
Hans


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to