|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|
Re: [PLUG] Re: plug Digest, Vol 16, Issue 31
|
Quoting Jeff Watson <redgibson@gmail.com>:
> I am having an issue with this part of my perl script.
>
> # eat output file, chop all lines but the load lines
> my $output = "c:\\TEST.out";
>
> if($ARGV[0]) {
> print $ARGV[0] . "\n";
> my $input = $ARGV[0];
> print $input
> }
> else {
> print "BAD INPUT: Missing parse target filename!";
> exit(0);
> }
>
> # ASSUME $input = C:\test.chm' !!
> #open(MYFILE, 'c:\test.chm'); # THIS WORKS!!!
> open(MYFILE, $input); # THIS FAILES!! :-/
>
> while(<MYFILE>) #Drops out on this line becuase the file is not able to be
> opened?
> .......
>
>
> -Jeff Watson
> -RedGibson@gmail.com
Jeff:
I always code the open statements as:
open MYFILE, "<$input" or die "Cannot open file $input" ;
so when it cannot open the file it will tell you.
I don't use perl in Windows a lot but I'd try double back-slash '\\'
in the file name because perl may be seeing the single backslash as
an escape for the next char when you pass it to the open function.
Eric
___________________________________________________________________________
Philadelphia Linux Users Group -- http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|