flock($fh, $mode) or die "Cannot flock file in $mode: $!";