in reply to Can't get flock() to work. Please help...

What am I doing wrong?
You're not using warnings (use strict and warnings).

The problem also exists on linux. Here is what you would get with warnings:

Name "main::FILE_HANDLE_1" used only once: possible typo at

See also: What shortcuts can I use for linking to other information?:

File Locking

Replies are listed 'Best First'.
Re^2: Can't get flock() to work. Please help...
by alain_desilets (Beadle) on Aug 30, 2011 at 19:26 UTC
    Cool! I have been using strict for years, but had never heard of warnings. I'll add that to my standard boilerplate code for Perl scripts. -- Alain

      Then change you file open boilerplate to:

      open my $fileIn, '<', $filename or die "Can't open $filename: $!";

      which uses the three argument form of open (you werre already actually, but just making it explicit), uses lexical file handles (with strict that would have caught your typo too) and reports open errors.

      True laziness is hard work