in reply to Comparing Arrays
Also, try not to write subroutines that use global variables, make them self contained.sub loop_eq { return 0 if $#a1 != $#a2; for(0..$#a1) { return 0 if $a1[$_] ne $a2[$_] } return 1; }
# loop_eq( \@array1, \@array2 ) sub loop_eq { return 0 if @$_[0] != @$_[1]; for(0..$#{$_[0]}) { return 0 if $_[0]->[$_] ne $_[1]->[$_] } return 1; }
|
|---|