#!/usr/bin/perl -w use Benchmark; my @a1 = qw(3 99 4 33 43 98 83 64 3 99 4 33 43 98 83 64 99 4 33 43 98 83 64); my @a2 = qw(3 99 4 33 43 98 83 64 3 99 4 33 43 98 83 64 99 4 33 43 98 83 64); sub join_eq { return join('',@a1) eq join('', @a2); } sub loop_eq { my $rc = 1; if ($#a1 != $#a2) { $rc = 0; } else { for (my $i=0; $i<=$#a1; $i++) { $rc = 0 if $a1[$i] ne $a2[$i]; } } return $rc; } timethese(100000, {join => \&join_eq, loop => \&loop_eq});