>>>>> "CD" == Chris Dolan <[EMAIL PROTECTED]> writes:
CD> Ahh, I see -- cargo cult. ;-) CD> Changing the topic a little bit... I've always suspected there was a CD> speed difference between local and my. So, I just benchmarked the CD> two versions, and "my" wins by a wide margin: CD> % perl test.pl CD> Rate local my CD> local 467290/s -- -33% CD> my 699301/s 50% -- makes perfect sense. my vars are not in the symbol table and just need an initialization at run time and they exist in the pad of a sub. localized vars need to save the previous value in some form of a stack (real work) and also get initialized. so local should be slower. as for the cargo cult, i agree. use local only when you MUST use it. mjd has a good article on the 7 valid uses of local. just declaring vars in a sub is not one of them. uri -- Uri Guttman ------ [EMAIL PROTECTED] -------- http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
