in reply to comparing the elements of an array
If you were doing it by hand, what would you do? Don't worry about writing the Perl code, write out the steps you'd give to someone else to perform the compare.
BTW, you should bracket your code with <code> and </code>, to make it readable...
In Section
Seekers of Perl Wisdom