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) = <NUM>;
seek(NUM, 0, 0) || die "Can't rewind next.num\n$!\n";
my($outNum) = $serviceNum + 10;
print NUM "$outNum";
close(NUM);

Rob

Good judgement comes from experience, and experience -
well, that comes from poor judgement.



On Wed, 28 Nov 2001, 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]

Reply via email to