Trying to open a file handle to write text to, but script keeps failing with the error:
Can't use an undefined value as a symbol reference at C:/Users/USER/Documents/script.pl line 207, <GEN1> line 20001.
at C:/Users/USER/Documents/script.pl line 207, <GEN1> line 20001.
Example code:
my $fileo = 'C:\Users\USER\Documents\report.txt';
# Open output file handle
my $fho = IO::File->new($fileo, 'w');
say $fho "THIS FILE: $fileo";
$fho->close();
I've checked Perldocs
and MetaCPAN
regarding module IO:File
but I can't see anything wrong with the syntax.
Any ideas?
The file path was wrong. Path did not exist. My bad...