in reply to nuances of my, and maybe local
The short version is you almost never, ever need to use local. Once upon a time, all variables were global. (Bad Perl, bad!) "Okay," they said, "we'll hack in a way to do local variables using the keyword local in Perl 4." That sort of worked, but not very well. So in Perl 5 they came out with my instead. That worked much better. Now they've added our to handle global variables.
Now, the language gurus (you know who you are) will tell you that what I said isn't really true, but it's close enough to true for most cases. (If you don't understand Einstein, Newton was close enough to get by.)
Summarizing, use my for the locals, our for the globals, and pretend that local doesn't exist.
Wally Hartshorn
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Don't Use Local
by merlyn (Sage) on Sep 27, 2002 at 19:28 UTC |