my $now = 8; my %url = ( monday => { @{[map(($_,1), (1..1000))]} } ); timethese(0, { Grep => 'Grep();', Grep2 => q{(sort grep {$_ <= $now} keys %{$url{"monday"}})[-1];}, Grep3 => sub{(sort grep {$_ <= $now} keys %{$url{"monday"}})[-1];} }); sub Grep{ $now = (sort grep {$_ <= $now} keys %{$url{'monday'}})[-1]; }