Unique values using grep

Of course there is an even shorter way to write it:

use strict;
use warnings FATAL => 'all';

my @data = qw(Foo Bar Moose Foo Baz Bar);

#my %seen;
#my @unique = grep { !$seen{$_}++ } @data;

my @unique = do { my %seen; grep { !$seen{$_}++ } @data };

print "@unique\n"; # Foo Bar Moose Baz

In this version you can even assign the values back to the original array writing:

@data = grep { !$seen{$_}++} @data;