C
ccc31807
use constant DIR => 'log_files';
mkdir DIR unless -e DIR;
This places a subdirectory in my current working directory named
log_files, creating it if it doesn't exist.
print_log();
sub print_log
{
open LOG, '>', "DIR/log.csv" or die "Cannot open LOG, $!";
...
}
This throws a DOES NOT EXIST error. However,
print_log(DIR);
sub print_log
{
my $dir = shift;
open LOG, '>', "$dir/log.csv" or die "Cannot open LOG, $!";
...
}
works just fine. What am I missing?
Thanks, CC.
mkdir DIR unless -e DIR;
This places a subdirectory in my current working directory named
log_files, creating it if it doesn't exist.
print_log();
sub print_log
{
open LOG, '>', "DIR/log.csv" or die "Cannot open LOG, $!";
...
}
This throws a DOES NOT EXIST error. However,
print_log(DIR);
sub print_log
{
my $dir = shift;
open LOG, '>', "$dir/log.csv" or die "Cannot open LOG, $!";
...
}
works just fine. What am I missing?
Thanks, CC.