in reply to Repeats exclusion
use warnings; use strict; open(my $COORD, "<", "coordinate.txt") or die("Couldn't read coordinate file - $!"); open(my $DIST, "<", "dist.txt") or die("Couldn't read distance file - $!"); my %coord; until (eof $COORD) { my $c = (split " ", scalar <$COORD>)[0]; my $d = (split " ", scalar <$DIST>)[0]; my $p = $coord{$c}; $coord{$c} = $d if !defined($p) || $d < $p; } close($COORD); close($DIST); print "$_\t$coord{$_}\n" for sort { $a <=> $b } keys %coord;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Repeats exclusion
by Grig (Novice) on Sep 12, 2010 at 11:22 UTC | |
by repellent (Priest) on Sep 12, 2010 at 11:43 UTC |