I want to do some task when the file is not opened in the Perl program below. But when I run it, I am getting syntax errors. What’s wrong with it?
my $LOGPATH = $ENV{DATA_OU};
my $LOGFILE = "cdj_rep" . "." . "test" . ".rpt";
if ! (open(OUT,">$LOGPATH/test1/work/$LOGFILE")) {
print "testin";
return;
}
close(OUT);
The ! needs to go inside the brackets: