I am using File::Find::Rule
on Strawberry Perl Windows.
when I run the following code:
@files = File::Find::Rule->file()
->in( $dir );
foreach my $file (@files){
say $file;
}
I get the list of files in this format:
C:\data\mydata\file/1.xls
and not this format:
C:\data\mydata\file\1.xls
What could be the problem?
The only problem is your expectations. C:\data\mydata\file/1.xls
is a perfectly valid Windows path.
File::Spec can normalize the path for you.
use File::Spec::Functions qw( canonpath );
$path = canonpath($path);
or
use File::Spec::Functions qw( canonpath );
@files = map { canonpath($_) } @files;