One may say that this effect may be avoided by remembering to carefully localize all package variables in all called functions,
Unintended side effects are unintended side effects:
sub G { our @ydata = 'Gaaaahh!'; };; sub F{ my @a = @_; print qq{pre-G: (@ydata)}; G(); print qq{post-G: (@ydata)}; };; F(1..4);; pre-G: () post-G: (Gaaaahh!)
The problem has nothing to do with aliasing and everything to do with not localising!
Your previous quote is better stated as: "don't use code that uses globals for no good reason.".
Which is doubly true for code that fails to localise its use of globals.
a healthy dose of paranoia.
Sorry, but I will always consider 'paranoia' in programming -- and pretty much everything else for that matter -- with exclusively negative connotations.
The teaching of 'paranoia', rather than 'knowledge', in an attempt to avert disaster, is always a counter productive and ultimately futile process.
With paranoia, one can only hope to avert bad consequences; with knowledge one can know you have.
Don't hope, know!
In reply to Re^4: aliasing arrays using typeglob under strict
by BrowserUk
in thread aliasing arrays using typeglob under strict
by RockyMtn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |