I am new to Perl coding. I ran into a problem while running a small script with me:
open cannot find the file that I give as an argument.
File Available:
ls -l DLmissing_months.sql
-rwxr-xr-x 1 tlmwrk61 aimsys 2842 May 16 09:44 DLmissing_months.sql
My Perl script:
use strict;
use warnings;
my $this_line = "";
my $do_next = 0;
my $file_name = $ARGV[0];
open( my $fh, '<', '$file_name')
or die "Error opening file - $!\n";
close($fh);
Perl script execution:
> new.pl DLmissing_months.sql
Error opening file - No such file or directory
What is the problem with my Perl script?
Vijay source
share