Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Flock Updating Counter

by busunsl (Vicar)
on Dec 06, 2002 at 10:42 UTC ( [id://218030]=note: print w/replies, xml ) Need Help??


in reply to Flock Updating Counter

You have the solution in your code:

#WRITE NUMBER BACK open(FH, "+< counter.dat");
This opens the file for reading and writing, so this should work:

#READ NUMBER, INCREASE AND WRITE NUMBER BACK open(FH, "+< counter.dat"); flock(FH, 2); $id = <FH>; $id++; seek(FH, 0, 0); truncate(FH, 0); print FH $id; close(FH);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://218030]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-26 01:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found