I am working in Cygwin on a Windows 7 machine. I linked Cygwin perl to windows strawberry perl.
10:13 PM Thu Jan 14$ ls -ltr /usr/bin/perl
lrwxrwxrwx 1 casper None 40 Nov 29 21:40 /usr/bin/perl -> /cygdrive/c/strawberry/perl/bin/perl.exe
I have a script that accepts a command line argument. When I put in the directory path, it cannot read the file in.
casperw@W01B6XLV /cygdrive/c/casper/DEV$ ./parseCMTA /tmp/example.txt
Error opening /tmp/example.txt - No such file or directory
I copy it to the same path that the script is in and it works just fine:
casperw@W01B6XLV /cygdrive/c/casper/DEV$ cp /tmp/example.txt .
casperw@W01B6XLV /cygdrive/c/casper/DEV$ ./parseCMTA example.txt
Short name – ORANGEJulius
GL- 7512522 ADP- 20692677
GL- 7512524 ADP- 21692677
CMTA TO MS 050
casperw@W01B6XLV /cygdrive/c/casper/DEV$ cat parseCMTA
#!/usr/bin/perl
use strict ;
use warnings ;
my $file_grab = $ARGV[0] ;
open my $CMTA_file , '<' , $file_grab or die "Error opening $file_grab - $!\n";
while (<$CMTA_file>) {
print $_ ;
}
How come the command line array @ARGV will not process the absolute path of the file location, however it will process the file when it is in the same directory. What is going on with the absolute path and the @ARGV array?