If you only need to know if the two arrays are identical, you can cheat a little by using join and eq.
@a = qw[1 2 3 4 5]; @b = qw[1 2 3 4 5]; @c = qw[1 2 3 4 6]; print "a is equivalent to b" if join("\0", @a) eq join("\0", @b); a is equivalent to b print "a is equivalent to c" if join("\0", @a) eq join("\0", @c);
This requires that you data doesn't contain nulls, and it will consume a large amount ram (breifly) if the arrays are large.
However, if you need to know where and/or what the differences are, then there is no avoiding a loop.
In reply to Re: comparing array elements
by BrowserUk
in thread comparing array elements
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |