my %myhash = (); do { my $k = join(":", @array1); last if(exists $myhash{$k}); $myhash{$k} = 0; }while(pop @array1);