$a_huge_value = 3200000; my($foo); $time1 = time(); for ($i = 0; $i < $a_huge_value; $i++) { $foo = getValue(); codeThatUsesFoo($foo); } $time2 = time(); for ($i = 0; $i < $a_huge_value; $i++) { my $foo = getValue(); codeThatUsesFoo($foo); } $time3 = time(); print $time2 - $time1, "\n"; print $time3 - $time2, "\n"; sub getValue { return $_[0]; } sub codeThatUsesFoo { return $_[0]; } #### [bobn@trc2:/home/bobn/misc]# perl my2.pl 14 14 [bobn@trc2:/home/bobn/misc]# perl my2.pl 13 15 [bobn@trc2:/home/bobn/misc]# perl my2.pl 13 15 [bobn@trc2:/home/bobn/misc]# perl my2.pl 14 16 #### sub getValue { return } sub codeThatUsesFoo { return } #### [bobn@trc2:/home/bobn/misc]# perl my2.pl 12 12 [bobn@trc2:/home/bobn/misc]# perl my2.pl 12 13 [bobn@trc2:/home/bobn/misc]# perl my2.pl 13 13 [bobn@trc2:/home/bobn/misc]# perl my2.pl 12 13