use strict; use Benchmark qw(cmpthese); my @a = 0..100; cmpthese(-1, { forward => sub { for (@a) {}; }, backward => sub { for (reverse @a) {}; }, } );