use Fctl; my $canmove=0; MOVE:{ open my $fh,$filename or last MOVE; $canmove=flock $fh, LOCK_EX|LOCK_NB; close $fh; } if ($canmove) {