my %seen; my @union = grep {! $seen{$_}++} @rows, @data;