How about this :-
open (SALARY,"c:/salary") || die"$!\n";
chomp (@read = );
close (SALARY);
$read = join '',@read;
$read = $read + 10;
open (SALARY,">c:/salary") || die "$!\n";
print SALARY $read;
close SALARY;
--- end of msg --
- Original Message -
From: "nafiseh saberi" <[EMAIL
This works for me.
use Fcntl qw(:flock);
open(NUM, "+< next.num") || die "Can't get new number\n$!\n";
flock(NUM, LOCK_EX) || die "Can't lock next.num\n$!\n";
my($serviceNum) = ;
seek(NUM, 0, 0) || die "Can't rewind next.num\n$!\n";
my($outNum) = $serviceNum + 10;
print NUM "$outNum";
close(NUM)
On Wed, 28 Nov 2001, Ahmed Moustafa Ibrahim Ahmed <[EMAIL PROTECTED]> wrote,
> Hi Nafiseh,
>
> I think can't open a file for reading and writing at the same time.
> Anyway, the following should help:
>
> #--
> open (FILE, $file) || die "Can't open $file: $!\n";
> $v
Hi Nafiseh,
I think can't open a file for reading and writing at the same time.
Anyway, the following should help:
#--
open (FILE, $file) || die "Can't open $file: $!\n";
$value = ;
close (FILE);
$value += 10;
open (FILE, ">$file") || die "Can't open $file: $!\n";