I haven't done that myself, but if I did I'd assume you'd have to do some kind of "locking". I did "perldoc -q lock", and here is *some* of what I got back:
--------------------------------------
=head1 Found in /usr/lib/perl5/5.00503/pod/perlfaq5.pod
=head2 How can I lock a file?
Perl's builtin flock() function (see L<perlfunc> for details) will call
flock(2) if that exists, fcntl(2) if it doesn't (on perl version 5.004 and
later), and lockf(3) if neither of the two previous system calls exists.
On some systems, it may even use a different form of native locking.
Here are some gotchas with Perl's flock():
=over 4
=item 1
Produces a fatal error if none of the three system calls (or their
close equivalent) exists.
=item 2
lockf(3) does not provide shared locking, and requires that the
filehandle be open for writing (or appending, or read/writing).
=item 3
Some versions of flock() can't lock files over a network (e.g. on NFS
file systems), so you'd need to force the use of fcntl(2) when you
build Perl. See the flock entry of L<perlfunc>, and the F<INSTALL>
file in the source distribution for information on building Perl to do
this.
For more information on file locking, see also L<perlopentut/"File
Locking"> if you have it (new for 5.006).
---------------------------------------
Do "perldoc -q lock" yourself and read through all the perldoc info on locking.
HTH.
Hardy Merrill
Mission Critical Linux, Inc.