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 = <FILE>; close (FILE); $value += 10; open (FILE, ">$file") || die "Can't open $file: $!\n"; print FILE "$value"; close FILE; #------------------------------ I don't know if it can be done in less code or not. Good luck, Ahmed Nafiseh Saberi wrote: > 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't work. > > open (SALARY,"-<c:/salary"); > read (SALARY,$salary,5) > > $salary=$salary+10; > > > > > print SALARY $salary; > > close SALARY; > > > would you help me to compelte it. > thx for annnnnnnnnnny help. > ___________________________ > > Nafiseh Saberi > ____________________________ > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]