use Modern::Perl; use Array::Compare; my @a = ( 1, 2, 3 ); my @b = ( 2, 3, 1 ); my @c = ( 1, 2, 4 ); my @d = qw/ a b c a /; my @e = qw/ a a b c /; my @f = qw/ 1 b c 1 /; my @g = qw/ 1 1 b c /; say 'The arrays are', ArraysIdentical( \@a, \@b ) ? ' ' : ' not ', 'identical.'; sub ArraysIdentical { Array::Compare->new()->perm( $_[0], $_[1] ) || 0; }