#!/usr/bin/perl -w use Benchmark ; use strict; my $count = shift || "-3" ; # set the test counter my @array = (); #load up an array of crap for ( my $i = 0; $i < 1000; $i++) { push @array, rand(256); } open NULL, "+/dev/null" or die "$!"; timethese ( $count, { 'join' => '&print_join', 'map' => '&print_map', 'field sep' => '&print_field' } ); # use join to print each array elemnet. sub print_join { print NULL join("\n", @array) ; } # use map to print each array elemnt, sub print_map { print NULL map{ $_ .= "\n"} @array ; } # use map to print each array elemnt, sub print_field { local $,="\n"; print NULL @array ; }