Josh wrote at Wed, 29 May 2002 23:56:48 +0200:
> Ok Heres the deal :) I have a script to write to a dat file and the basic output in
>the dat file
> is
>
> username:plan: so an example would be
> computer:50: meaning the username computer has 50 hours of paid dialup access.
>
> Now Lets say "computer" calls and wishes to upgrade his account to 100 hours, i need
>to figure out
> how to script it so that it replaces the number with the new one..know what i mean?
>
my $user = "computer";
my $upgrade = 100;
open DAT, "<your_file.dat" or die "Cant open ...";
my @dat = (<DAT>);
close DAT;
open DAT, ">your_file.dat" or die "Cant open ...";
while (@dat) {
print DAT /^$user/ ? "$user:$upgrade:\n" : $_;
}
close DAT;
Is it what you need ?!
Greetings,
Janek
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]