use Benchmark; use List::Util qw(first); use strict; my @big_array = (1 .. 20); my %x; $x{$_} = \@big_array for (1 .. 100); sub search_5_6 { scalar grep { scalar grep { $_ == 5 } @$_; } values %x; } sub search_5_7 { # Scalar-List-Utils is part of 5.7.2 and onward first { first { $_ == 5 } @$_; } values %x; } timethese(10000, { 5.6 => \&search_5_6, 5.7 => \&search_5_7 } ); =head1 Benchmark: timing 10000 iterations of 5.6, 5.7... 5.6: 47 wallclock secs (32.57 usr + 0.00 sys = 32.57 CPU) @ 307.03/s (n\ =10000) 5.7: 1 wallclock secs ( 0.57 usr + 0.00 sys = 0.57 CPU) @ 17543.86/s \ (n=10000) =cut