in reply to Looping through arrays : are they equal ?

I don't think your code works to spec. You are only checking if the lists are the same length, not if the content is identical. For that, you need something like what you find in perlfaq4's How do I compute the difference of two arrays? How do I compute the intersection of two arrays? or How do I test whether two arrays or hashes are equal?.

As a side note, both times you use scalar in your code it is a no-op - if necessarily enforces scalar context.