Re: open read write

2001-11-28 Thread Leon
- Original Message - From: "nafiseh saberi" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, November 28, 2001 7:14 PM Subject: open read write hi all. how r u ? I wish all of you be fine and happy. I want to ... 1- open an existing file 2- read the number tha

Re: open read write

2001-11-28 Thread Rob
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)

Re: open read write

2001-11-28 Thread Hasanuddin Tamir
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

Re: open read write

2001-11-28 Thread Ahmed Moustafa Ibrahim Ahmed
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";

open read write

2001-11-28 Thread nafiseh saberi
hi all. how r u ? I wish all of you be fine and happy. I want to ... 1- open an existing file 2- read the number that exist in it 3- add it with 10 4-write the result in file. 5- note: I want to earse the last number and write the result instead of it. I write some code ..but doesn