We don't bite newbies here... much | |
PerlMonks |
Re: Flockingby Ovid (Cardinal) |
on Jun 22, 2000 at 21:42 UTC ( [id://19473]=note: print w/replies, xml ) | Need Help?? |
maleteen2000, yes, people gave you grief yesterday for your excessive questions in the Chatterbox. While, on one hand, it gets annoying that you keep asking basic questions that are already answered all over this site and others (in fact, the DBI questions you were asking yesterday were dealt with in a post ... yesterday), on the other hand, I do have to commend you on your perserverence in the face of adversity. I'll answer your question, but I'll also list a few resources that you can use to look things up on your own.
First, I assume that the above code is pseudocode, because it's terrible. I'll give you the benefit of the doubt. Second, what you really want to do (at least, as far as I can tell from your example), is to modify a file in place with update mode ("+<").
This code allows you to open the file, read its contents, modify them, and write them back out without having to close and reopen. I haven't tested it with flocking, so you'll need to play with it to see what type of flock works. Please note that flocking a file doesn't stop others from playing with it. They can still modify the file if they don't check to see if it's flocked. Further resources:
Cheers! PS: I took the above code straight from the Perl Cookbook. Beg your parents for a copy.
In Section
Seekers of Perl Wisdom
|
|