The stupid question is the question not asked | |
PerlMonks |
Hair Splitting?by harleypig (Monk) |
on Dec 13, 2001 at 01:17 UTC ( [id://131411]=perlquestion: print w/replies, xml ) | Need Help?? |
harleypig has asked for the wisdom of the Perl Monks concerning the following question: I ran across the following line of code in Class:Struct and was curious about it. I did some benchmarks and, depending on what and how it was used, it was anywhere from 10-15% faster for large iterations than what I would have used.
my $isa = do { no strict 'refs'; \@{$class . '::ISA'}; }; I would have used the following: my $isa; { no strict "refs"; $isa = \@{$class . '::ISA'}; } Now, I understand *what* is happening with Damien's code, but not *why* it's so much faster. I'm thinking it has something to do with the separation of the declaration and definition of the $isa variable, but I don't see why.
Any ideas? Harley J Pig
Back to
Seekers of Perl Wisdom
|
|