#!/usr/bin/perl

#  --------
#  PROGRAM:  2try.pl  (created by Developer's Daily, http://www.DevDaily.com)
#  --------

$LOCK_EXCLUSIVE = 2;
$UNLOCK         = 8;

# -----------------------
# What's about to happen:
# -----------------------
# open the file, try to lock the file, then write, then unlock the
# file, then close the file.

open (FILE, ">> test.dat") || die "problem opening test.dat\n";

flock FILE, $LOCK_EXCLUSIVE;
print FILE "this line printed by 2try.pl\n";
flock FILE, $UNLOCK;
close(FILE);

