Hi everyone
Need help with this please, pretty please!!
I open a file containing this:
e.g.
John:1111111:0
Peter:2222222:0
Jane:3333333:0
Now I select a particular name from an input.
Now comes the part I'm having trouble with. For that name I've selected how
do I increment the count value.
e.g.
If I select Peter then file is modified to this:
John:1111111:0
Peter:2222222:1
Jane:3333333:0
and so on....
Heres the sub routine that needs to be fixed....
sub FIND {
open (FIND, "prac1.txt") or die "$! file error";
#open file
while (<FIND>) {
($name, $phone, $count) = split(/:/, $_);
#separate values
if ($name =~ $compare[1])
{ #compare name
value with input
print "$phone\n";
#display phone number for that name
close FIND;
open (APPEND, ">>prac1.txt") or die "$! file error";
#increment count value for that name,
$count++;
#and substitute it with original count.
substitute APPEND $count;
close APPEND;
}
}
}
Thanks heaps
Patrick Bateman
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]