On Monday, May 6, 2002, at 09:35 , Rafael Cotta wrote:
[..]
> Can someone give me a little function that will receive a filename and a
> string, and append this string to the file referenced by filename?

you mean something like:

### sub MakeTmpFile {
###     my ($file, @mlist ) = @_;
###     open(FH, ">> $file") or die "unable to open $file:$!\n";
###     print FH "$_\n" foreach(@mlist);
###     close FH ;
###
### } # end of MakeTmpFile

that takes a list of lines to append to the file vice a single
string - but I guess it would still work...

> My problem is that this will run on a webserver. Do I have to use lock or
> there's no problem when appending to a file?

are you running this under mod_perl and hence could have more
than one invocation all trying to append to the same file????

Yeah a lock file IS a way to solve that type of problem.


ciao
drieux

---

ps: If I can be of help email me directly... or read from
where I am stashing the bits and bobs that i have demoed:

http://www.wetware.com/drieux/CS/lang/Perl/Beginners/


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to