Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1076072]
help
Chatterbox?
[Corion]: LanX: Ah, that explains a lot :)
[marto]: Nobody we spoke to in Berlin had a clue who Hasslhoff was
[erix]: heh: The Dutch do one thing very, very well
[LanX]: the sidekick of this blonde playboy model which was saving lives with her red bathing suit ... (what was her name again ...)
[choroba]: Pamela Anderson?
[choroba]: erix: I'm proud to be from a nation that also does one thing well
[LanX]: ah yes! And he called her Kit and she could talk while a light was going from her left to right eye and back...
[erix]: choroba: pretty impressive! :)
LanX imagines which nations would be dominating if the winter olympics were invented in East Asia

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2018-02-23 16:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (303 votes). Check out past polls.

    Notices?