my %votes; my $file = 'vote.txt'; open my $ih, $file or die $! while (<$ih>) { chomp; my ($user, $count) = split ','; $votes{$user} = $count; } close $ih; $votes{sam}++; open my $oh, $file or die $! for my $user (keys %votes) { print $oh "$user,$votes{$user}\n"; } close $oh; #### # From print VOTE $user[$count]."|".$vote[$count]; # To print VOTE $user[$count]."|".$vote[$count]."\n";