use Benchmark qw(cmpthese); @data = (1,2,3,4); # the values that would have been in @_ my $minCPUsec = 15; cmpthese(-$minCPUsec, { with => \&sub_with_ifs, without => \&sub_without_ifs });