I am new to Perl coding
The file is available:
Code> I am experiencing a problem, while I am executing a small script: Ls -l DLmissing_months.sql -rwxr-xr-x 1 tlmwrk61 aimsys 2842 May 16 09:44 DLmissing_months.sql
My Perl script:
#! Use / usr / local / bin / perl strict; Use warnings; My $ this_line = ""; My $ do_next = 0; My $ file_name = $ ARGV [0]; Open (my $ FH, '& lt;', '$ file_name') or dead "Error opening file - $! \ N"; Close ($ FH);
Performed Perl script:
& gt; New.pl Error opening file DLmissing_months.sql - No such file or directory
What is the problem with my Perl script?
Repeat single quotes. Instead of opening DLmissing_months.sql
, you are trying to open a file named $ file_name
, use double quote marks to repeat things. In this case, you can only use the variable itself:
open (my $ FH, '
Comments
Post a Comment