Perl open call failing.

Posted by benjamin button on Stack Overflow See other posts from Stack Overflow or by benjamin button
Published on 2010-05-17T10:01:08Z Indexed on 2010/05/17 10:10 UTC
Read the original article Hit count: 376

Filed under:
|

I am new to perl coding. I am facing a problem while executing a small script i have: open is not able to find the file which i am giving as an argument.Please see below:

File is available:

 ls -l DLmissing_months.sql
-rwxr-xr-x   1 tlmwrk61 aimsys      2842 May 16 09:44 DLmissing_months.sql

My perl script:

#!/usr/local/bin/perl

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);

executing the perl script :

> new.pl DLmissing_months.sql
Error opening file - No such file or directory

what is the problem with my perl script.

© Stack Overflow or respective owner

Related posts about perl

Related posts about unix