# The same (obviously working): @a = qw(1 2 3 4 5 4 3 2 1); @b = grep { !$_{$_}++ } @a; print "@b" #1 2 3 4 5