in reply to flock with anonymous filehandle
Just a few more things....
my($openokay) = open(MW,"+<$filename"); if (!$openokay) { return 0; }
this could be done much more efficiently:
open(MW,"+<$filename") || return 0; # Or even... sub fileopen { my ($filename) = shift; if ( open(MW,"+<$filename") ) { lock(*MW); seek(MW,0,0); return *MW; } else { return 0; }
Also, try using the var = shift syntax for getting arguments in a subroutine. I've run into too many problems trying to use the @_. (Think about it, shift returns the first value of an array.)
And this is the usual reminder, use Strict, and -w...
And GOD said unto them, "Dids't thou use strict??"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: flock with anonymous filehandle
by wog (Curate) on Jun 10, 2001 at 00:06 UTC | |
by Xxaxx (Monk) on Jun 10, 2001 at 06:32 UTC | |
by Anonymous Monk on Jun 11, 2001 at 13:24 UTC |