in reply to $1 not "freezing" in an addition
By "interpolating"/"quoting" the $1 perhaps the acctual value of $1 at that stage in the recursion gets indeed saved somehow.
It is always a good idea to immediately save those special variables (such as $_, @_, $1, ...) into a lexical variable to avoid these pitfalls. We tend to forget that these are global variables that are therefore prone to "action at a distance".
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
My blog: Imperial Deltronics
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: $1 not "freezing" in an addition
by Anonymous Monk on Dec 14, 2012 at 17:29 UTC | |
by ikegami (Patriarch) on Dec 16, 2012 at 14:19 UTC | |
by Anonymous Monk on Dec 17, 2012 at 09:13 UTC | |
by ikegami (Patriarch) on Dec 17, 2012 at 13:12 UTC | |
by Anonymous Monk on Dec 17, 2012 at 13:42 UTC | |
| |
by Anonymous Monk on Dec 17, 2012 at 09:15 UTC |