Further testing indicates that we are getting side tracked by the single quote issue. That is if we change the input file so it specifies a file or directory name that contains extended ascii as in an accented e (0x82) then we get the same result with the stat function. Windows accepts these name. stat does not. The name I tested with came from my Adobe Acrobat installation in C:\Program Files (x86).
Here is the modified program run against an updated input file.
use 5.12.0; use strict; use warnings; use Carp; open IN,"<DirList2.txt"; my $fn=<IN>; chomp $fn; my @st=stat $fn; if (@st) { say "Array defined"; } else { say "Array undefined"; }
The input was:
C:\Program Files (x86)\Adobe\Acrobat 10.0\Acrobat\Sequences\FRA\Cr0xc20x82er des fichiers PDF accessibles.sequ
The output was:
Array undefined
In reply to Re^3: stat on file name containing single quotes
by perlpipe
in thread stat on file name containing single quotes
by perlpipe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |