Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Question on "my" in the variables

by sundialsvc4 (Abbot)
on Feb 25, 2014 at 01:51 UTC ( #1076072=note: print w/replies, xml ) Need Help??

in reply to Question on "my" in the variables

Simply stated, “the real objective here is:

When you are about to shoot yourself in the foot(!!) ... it is much better for the computer to go ‘click’ than to go ‘BANG!!’.

If you “simply” declare all variables to be global, then the ever-accommodating “I presume that you know what you are doing” Perl language will generally try its best to accommodate you.   However, you probably would much prefer that it should detect as many of your errors as possible.   Instead of telling Perl that variables should have the widest possible scope, you probably want to be as specific as possible, and then to use strict; use warnings; so that the computer will have the greatest possible chance of detecting your unintended screw-ups.   Instead of letting Perl run amok, let Perl decline to run your code at all.

Execution-speed is really not the point:   no one is in a hurry to get the wrong answers (or, far worse, “unexplainable but obviously-wrong behaviors”) quickly.

Replies are listed 'Best First'.
Re^2: Question on "my" in the variables
by AnomalousMonk (Chancellor) on Feb 25, 2014 at 04:06 UTC

    ... or far, far, far worse, apparently correct behavior that is only discovered (and discovered, inevitably, in full view of your colleagues/boss/client/the world) to be wrong after a program has run for weeks or months and corrupted some vital database or transaction history that can only be corrected with vast effort and expense — if you're lucky and it can be corrected at all!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1076072]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2018-05-22 05:14 GMT
Find Nodes?
    Voting Booth?