No such thing as a small change | |
PerlMonks |
Re: $ENV {'FOO'} $fooby Rich36 (Chaplain) |
on Feb 14, 2002 at 20:30 UTC ( [id://145552]=note: print w/replies, xml ) | Need Help?? |
I tested this idea out with this code.
Using 1000 iterations in the loop, the results I got were... So it looks like there was some performance gain in that example using the stored var instead of directly accessing the hash value. I would guess that the second loop was faster because the application didn't have to search through a hash for the value, but someone else who has a better idea of the internal workings of Perl might be able to tell you more. Personally, if I'm using a lot of environment variables, I like to assign them to variable names so I can assign them a name I want and not have to worry about typing $ENV{FOO} again and again. Rich36 There's more than one way to screw it up...
In Section
Seekers of Perl Wisdom
|
|