my %Hash; while () { # the lines are composed of elements separated by a point comma <-- it's a called a semicolon! chomp; my ( $k, $v )= split /;/; $Hash{$k} += $v; } my @unique = keys %Hash;