The stupid question is the question not asked | |
PerlMonks |
Re: Comparing unordered but similar data filesby Kanji (Parson) |
on Sep 23, 2010 at 00:37 UTC ( [id://861413]=note: print w/replies, xml ) | Need Help?? |
Your use of eq is actually comparing the number of elements in each array, which is why you only see a failure if one file has more lines than the other. If you're using Perl 5.10 or newer, you can achieve what you want using ~~ (the smart match operator) instead:-
If you're using Perl 5.8 or older, you'll need to compare the arrays element by element, an example of which you can find in perlfaq4 - How do I test whether two arrays or hashes are equal?. --k.
In Section
Seekers of Perl Wisdom
|
|