amadain has asked for the wisdom of the Perl Monks concerning the following question:
The problem is when I am typing in a result and I get it wrong and backspace over it and enter the correct value the file gets updated with the old value as well as the new value# update values with this weeks results and scores for (my $j = 0; $j <= $#teams; $j++) { print "\nDo You have results for $teams[$j] (y\\n)?\n"; $answer=<STDIN>; chomp($answer); if ($answer =~ /[Yy](es)*/) { $team_number = $j*5; $Values[$team_number]=$teams[$j]; print "$j\t\t$Values[$team_number]\n"; print "\nHome Result ((W D or L) _ if its an away game):\n +"; $home_result=<STDIN>; chomp($home_result); $home_result=~s/\s+$//g; $Values[$team_number+1]=~s/($Values[$team_number+1 +])/$1$home_result/g; exit 1; } # update storage file open(SNMPFILE,"+< store.txt"); for ($ae = 0; $ae <= $#Values; $ae++) { print SNMPFILE "$Values[$ae] "; } close(SNMPFILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: overwritten values showing in storage file
by jfroebe (Parson) on Nov 10, 2004 at 17:49 UTC | |
by amadain (Novice) on Nov 11, 2004 at 09:21 UTC | |
|
Re: overwritten values showing in storage file
by ikegami (Patriarch) on Nov 10, 2004 at 16:14 UTC | |
by amadain (Novice) on Nov 10, 2004 at 16:17 UTC | |
by ikegami (Patriarch) on Nov 10, 2004 at 16:37 UTC |