in reply to Re: Count number of lines?
in thread Count number of lines?

After the "open I, 'users.dat' or warn..." line, would this line flock the file?: flock I, 2; Thanks. slcpub@yahoo.ca

Replies are listed 'Best First'.
Re: Re: Re: Count number of lines?
by VSarkiss (Monsignor) on Jun 20, 2001 at 18:51 UTC
    Yes. I is a filehandle here, and can be used as the first argument to flock, as well as others like seek.

    BTW, to avoid having to remember that 2 is "exclusive lock", you can use symbolic names from the Fcntl module:

    use Fcntl; ... flock(I, LOCK_EX);
    See the perlfunc document for details.