in reply to Re^2: comparison of two arrays
in thread comparison of two arrays
(Note: Not tested.)sub compare_arrays { my ($array1, $array2) = @_; my @temp1 = sort @$array1; my @temp2 = sort @$array2; return 0 unless $#temp1 = $#temp2; # If number of elements is differ +ent, they don't match for my $i (0..$#temp1) { return 0 unless $temp1[$i] eq $temp2[$i]; # Something's different +, no match } return 1; # OK, they match. }
|
|---|