#/usr/bin/perl -w use strict; use Benchmark; sub f { our %d; local *d = shift; $d{$_}=$_ foreach (0 .. 200); } sub b { my $d = shift; $$d{$_}=$_ foreach (0 .. 200); } my %c; timethese (100000, { 'f' => '&f(\%c)', 'b' => '&b(\%c)', }); #### Benchmark: timing 100000 iterations of b, f... b: 83 wallclock secs (67.82 usr + 14.38 sys = 82.20 CPU) @ 1216.55/s (n=100000) f: 80 wallclock secs (65.86 usr + 13.95 sys = 79.81 CPU) @ 1252.98/s (n=100000)