#!/usr/bin/env perl use strict; use warnings; use Benchmark qw[cmpthese timethese]; my @A = qw[this that these those]; my $result = timethese( -5, { test => sub { print @A }, with_for => sub { print for @A }, with_join=> sub { print join '', @A }, }); cmpthese($result); __END__