Thanks for the info Curis. I don't think I saw any answers from the more internal aware gurus out there and like Curtis, I would certainly like to know more about this.
TIA At 14:32 2002.01.08, Curtis Poe wrote: >--- Eric Beaudoin <[EMAIL PROTECTED]> wrote: >> I was wondering if someone could explain why a variable define with a global scope >was slower >> that one define within the local lexical scope when used in a loop? > >If I recall correctly, you should usually get better performance from lexically >scoped variables >than from global ones. Lexically scoped variables are stored in a private >"scratchpad" array and >can be accessed directly by Perl. > >Globals, on the other hand, are stored in a public symbol table in a typeglob. Perl >has to do a >hash lookup in the symbol table and then get the corresponding entry in the typeglob >for the >variable you need. No such lookup in necessary for lexicals, hence the better >performance. > >Any internals people around? I'd love to hear some more knowledgeable people >/(?:correct|expand >upon)/ this. > >Cheers, >Curtis "Ovid" Poe > >===== >"Ovid" on http://www.perlmonks.org/ >Someone asked me how to count to 10 in Perl: >push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; >shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A > >__________________________________________________ >Do You Yahoo!? >Send your FREE holiday greetings online! >http://greetings.yahoo.com > >-- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] ----------------------------------------------------------- Éric Beaudoin <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]