my %saw; my @out = grep { ! $saw{$_}++ } @in; #### my @out = do {my %saw; grep !$saw{$_}++, @in};