[ create a new paste ] login | about

Link: http://codepad.org/xmAJDdvo    [ raw code | output | fork ]

Perl, pasted on Jun 21:
use warnings;
use strict;

my %sequence;

local $/ = "\r\n\r\n"; 
while (<DATA>) {
  my ($name, $count) = split; 
  last if $name eq 'XXX';
  $sequence{$name}{count} = $count;
}

while (<DATA>) {
  my ($name, $length) = split;
  if (exists $sequence{$name}) { 
    $sequence{$name}{length} = $length;
  } 
}

for my $name (sort keys %sequence) {
  print "$name, $sequence{$name}{count}, $sequence{$name}{length}", "\n";
}
__DATA__
NM_000014   
1

NM_000016   
3

NM_000017   
19

NM_000018   
2

XXX
XXX

NM_000014   
56

NM_000016   
67

NM_000017   
239

NM_000018   
2333


Output:
1
2
3
4
NM_000014, 1, 56
NM_000016, 3, 67
NM_000017, 19, 239
NM_000018, 2, 2333


Create a new paste based on this one


Comments: