use strict; use warnings; use Spreadsheet::Read; my $ss = ReadData ("4_19_10_Zrc01a-2.xls"); my $s = $ss->[1]; my %max; foreach my $r (1 .. $s->{maxrow}) { my ($A, $B) = ($s->{cell}[1][$r], $s->{cell}[2][$r]); $max{$A} //= $B; $max{$A} < $B and $max{$A} = $B; } print "$_\t$max{$_}\n" for sort { $a <=> $b } keys %max; #### $ perl test.pl 1 4 2 7 3 10 $