Both tests set and reference the variable 1000 times each.
Yep. Would you write code like that in a real program?
I haven't either, but thanks for doing that benchmark. If I ever need to micro-optimize pointless silly busywork for speed, I'll be sure to keep in mind that some useless loops are faster than others in this one example.
Improve your skills with Modern Perl: the free book.
In reply to Re^6: Avoiding Globals with OO Perl
by chromatic
in thread Avoiding Globals with OO Perl
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |