my @a = qw/ 1 2 3 4 5 6 7 8 9 5 7 9 /; my %h; $h{$_}++ for @a; my @dups = grep { $h{$_} > 1 } keys %h; print "@dups\n";