geo has asked for the wisdom of the Perl Monks concerning the following question:
I have a data file containing one or more windows folder paths which I load into an array. When I work through the array and attempt to use the folder path it is not recognized as a valid path. Each line in the data file looks like the following.
C:\HELP\Docs\R2009\sp01\For this exercise I am using a simple file test to verify the existance of the folder. The actual script uses strict, warnings, and error checking.
my $datafile = "C:\\HELP\\PerlScripts\\Test2.dat"; my (@PATHS); open (DATAFILE,"< $datafile"); while (defined (my $line = <DATAFILE>)) { chomp($line); push (@PATHS,$line); } foreach my $path (@PATHS) { if (-d $path) { print "Found $path \n"; } else { print "DID NOT FIND $path \n"; } }
The previous example code prints "DID NOT FIND C:\HELP\Docs\R2009\sp01\"
The result is the same when the data file entry is C:\\HELP\\Docs\\R2009\\sp01\\
I even went so far as to split the path on "\\" and used join to reconstruct the file path but the results were the same. I assume that I am missing sommething (hopefully something simple) and that one of you fine folks will be able to point that out to me.
Thanks in advance.
|
|---|