P is for Practical | |
PerlMonks |
Re: Re: Comparing hashes without sorting the keysby BrowserUk (Patriarch) |
on Feb 20, 2004 at 03:40 UTC ( [id://330442]=note: print w/replies, xml ) | Need Help?? |
There are a few problems with that. If the hash values are not numeric your == will cause trouble. Switching that to eq will get you some way, but then values of '079' and '79' don't compare equal although they may be considered so for the applications use of them. Then you get into more esoteric problems. What if the values of the hash are themselves hashes or arrays (references). Comparing the stringyfied references will say that two arrays are different even if their contents is similar as they will have different addresses. Are two content-similar, but physically different arrays considered equal? That's almost a philisophical debate and very much depends on the application. That said. Many of these problem exists with most of the other solutions offered also. Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham"Think for yourself!" - Abigail Timing (and a little luck) are everything!
In Section
Seekers of Perl Wisdom
|
|