L
Lalo Salvalus
I have a simple script that I can't get to read a file and am not sure
why.
Here's the script:
=============================================
use Getopt::Std;
getopts('d:hi:f:');
my @lines;
if ($opt_f) { readFile($opt_f)};
sub readFile {
my $filein = pop;
open (FIN, '< $filein' ) || die "cannot open file $filein, $!\n";
while ( <FIN> ) {
push @lines;
}
} # readFile
print "\@lines is @lines\n";
=============================================
When I run this from the command line I get "The system cannot find
the file specified." no matter if I have a copy of the file in the
same dir as the script, or if I specify a full path (with either
backslashes, forward slashes, or double back slashes), or if I specify
a relative path (with either backslashes, forward slashes, or double
back slashes):
C:\Perl>perl -w Test.pl -f myfile.txt
cannot open file myfile.txt, The system cannot find the file
specified.
I'm running ActivePerl 5.8.3 build 809 on Windows 2000.
All help is appreciated.
thanks,
Lalo
why.
Here's the script:
=============================================
use Getopt::Std;
getopts('d:hi:f:');
my @lines;
if ($opt_f) { readFile($opt_f)};
sub readFile {
my $filein = pop;
open (FIN, '< $filein' ) || die "cannot open file $filein, $!\n";
while ( <FIN> ) {
push @lines;
}
} # readFile
print "\@lines is @lines\n";
=============================================
When I run this from the command line I get "The system cannot find
the file specified." no matter if I have a copy of the file in the
same dir as the script, or if I specify a full path (with either
backslashes, forward slashes, or double back slashes), or if I specify
a relative path (with either backslashes, forward slashes, or double
back slashes):
C:\Perl>perl -w Test.pl -f myfile.txt
cannot open file myfile.txt, The system cannot find the file
specified.
I'm running ActivePerl 5.8.3 build 809 on Windows 2000.
All help is appreciated.
thanks,
Lalo