my %seen; @found = map { join("\t", @{$_}) } grep { !$seen{$_->[-1]}++ } sort { $b->[0] <=> $a->[0] } map { [split("\t", $_)] } @found;