Problems with perl script on 6.1/5.8.8

Jonathan McKeown jonathan at hst.org.za
Wed Feb 7 09:37:02 UTC 2007


On Tuesday 06 February 2007 22:24, Don O'Neil wrote:
> I've got a perl script that just refuses to run on my new 6.1 box with Perl
> 5.8.8... Whenever I run it from the command line I get this:
>
> Can't modify single ref constructor in lock at ./caldisp.pl line 84, near
> "*LOCKF)"
> Execution of ./caldisp.pl aborted due to compilation errors.
>
> The lines in question are:
>
> if (open (LOCKF, ">$LOCKF"))
> {
>     lock (\*LOCKF);
> }

No real comment on the error, but shouldn't you be using flock() rather than 
lock()? flock is for locking files, lock is for locking shared variables in 
threads (unless of course you have a lock() subroutine defined somewhere, in 
which case it overrides the CORE::lock).

See perldoc perlopentut for details (it's hard to say more without more 
context).

Jonathan


More information about the freebsd-questions mailing list