#!/usr/bin/perl use strict; use warnings; my $input = $ARGV[0] or die "Usage: $0 "; open(my $fh, '<', $input) or die "Unable to open '$input' for reading: $!"; my %high; while (<$fh>) { chomp; my ($item, $group, $count) = split ' '; $high{$item} = $count if ! defined $high{$item} || $count > $high{$item}; } for my $item (keys %high) { print "$item high count was $high{$item}\n"; }