How do you use a variable ($FH) as a file handle?
this doesn't work for me:
this doesn't work for me:
Code:
use Fcntl qw(:flock);
fopen(FILE, "test.txt");
fprint(FILE, "some text here....");
fclose(FILE);
sub fopen
{
my ($CN,$path) = @_;
open($CN, $mode, $path);
flock($CN, LOCK_EX);
}
sub fprint
{
my ($CN,$string) = @_;
print $CN $string;
}
sub fclose
{
flock($CN, LOCK_UN);
close($CN);
}