in reply to Re^9: Making a variable in a sub retain its value between calls
in thread Making a variable in a sub retain its value between calls
I don't know how to reply to this other than to re-iterate what I wrote in nodes 449075 and 449081. But I'd like to remark that from your response and ihb's, you apparently consider INIT blocks to be at best useless, at worst harmful, and certainly misnamed (i.e. not suitable for initialization). Do you have any use for them?
Update: OK, I looked up INIT blocks in the Camel, wondering if I would find some dire warnings against their use. On p. 223 (3d edition), in a discussion of precisely the problem the OP posted, the book states
...you'll need to make sure any run-time assignment to my is executed early enough, either by putting the whole block before your main program, or, alternatively, by placing a BEGIN or INIT block around it to make sure it gets executed before your program starts.So what I wrote is essentially the same thing that the Perl docs say. If INIT blocks are so evil, why is the Camel giving such advice?
the lowliest monk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^11: Making a variable in a sub retain its value between calls
by ikegami (Patriarch) on Apr 19, 2005 at 19:09 UTC | |
|
Re^11: Making a variable in a sub retain its value between calls
by ihb (Deacon) on Apr 19, 2005 at 16:08 UTC | |
by TimToady (Parson) on Apr 19, 2005 at 16:28 UTC |