Problems? Is your data what you think it is? | |
PerlMonks |
Re^3: Making a variable in a sub retain its value between callsby ihb (Deacon) |
on Apr 18, 2005 at 23:41 UTC ( [id://449061]=note: print w/replies, xml ) | Need Help?? |
I'm partial to INIT blocks myself Noooooooooooo! Please please please don't do that! It will break if you put the code using the INIT block in a module and that modules is directly or indirectly required (i.e., loaded after program compile-time). INITs are not executed right after the file in which it was found is done compiling. It's executed after the program file is done compiling. INIT is used when you need to Personally I go with adding a BEGIN before the bare block, thus avoiding to retype the variable name.
Update: added clarification. ihb
See perltoc if you don't know which perldoc to read!
In Section
Seekers of Perl Wisdom
|
|