in reply to Bug in Array::Compare?
You are initializing your arrays with array references, and the documentation of the module states that it works by using join to turn both arrays into strings and comparing the strings using eq, so, assuming that it makes only one level of dereferencing, this means that internally, it makes the comparison between "[1,2]" and "[2,1]" which are not the same string.
In fact, the same problem arises when using the same array in the references:
print $comp->compare ([[1,2]],[[1,2]]) ? "Yes\n" : "No\n"; print $comp->compare ([1,2],[1,2]) ? "Yes\n" : "No\n";
prints:
No Yes
Hope this helps,
citromatik
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Bug in Array::Compare?
by planetscape (Chancellor) on Apr 07, 2009 at 08:31 UTC |