my @data = ( # all that stuff # ); my %hash; foreach (@data) { $hash{$_} = 1; } my @new_data = keys %hash;