It feels like a horrible abuse of Perl's data types... and it emits a warning if
@input has an odd number of elements... and you lose the original ordering of your elements... and you lose data entirely if two odd elements are the same... but you
could do it by coercing
@input into a temporary hash if you really wanted to:
{ my %foo = @input; @output = grep { defined } values(%foo); }
But I really, really doubt that you actually want to do it that way.