my %hash = (); while() { chomp; my ($k, $v) = split / \s+ \d+ , \s+ /x; $hash{$k} = $v unless exists $hash{$k}; }