in reply to Comparing Arrays

Your loop func isn't quite fair. It should be short-circuited:
sub loop_eq { return 0 if $#a1 != $#a2; for(0..$#a1) { return 0 if $a1[$_] ne $a2[$_] } return 1; }
Also, try not to write subroutines that use global variables, make them self contained.
# loop_eq( \@array1, \@array2 ) sub loop_eq { return 0 if @$_[0] != @$_[1]; for(0..$#{$_[0]}) { return 0 if $_[0]->[$_] ne $_[1]->[$_] } return 1; }