in reply to Duplicate removal
use strict; use warnings; my %data; while (<DATA>) { my @cols = split; my $col3 = pop @cols; my $key = "@cols"; push @{ $data{$key} }, $col3; } for (keys %data) { print "$_ ", join(',', @{ $data{$_} }), "\n"; } __DATA__ chr1 12345 34567 gene1 chr1 12345 34567 gene2
Output:
chr1 12345 34567 gene1,gene2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Duplicate removal
by perl_paduan (Initiate) on Apr 07, 2010 at 16:38 UTC |