in reply to compare two arrays

If you can be sure that a certain character (or a sequence of characters) doesn't appear anywhere in your arrays, you can use join and string comparison:
my $sep = chr(0); if (join($sep, @a) eq join($sep, @b)) { ... }

TIMTOWTDI.