【发布时间】:2014-01-07 09:40:26
【问题描述】:
为什么下面的代码不起作用?
-d 和 -f 在我的 Windows 机器上不起作用。
use strict;
use warnings;
use Data::Dump qw/pp/;
my $path="C:/perl/workspace";
opendir ( DIR, $path ) || die "Error in opening dir $path\n";
my (@file,@dir);
while (my $filename=readdir(DIR)) {
next if ($filename =~ m/^\./);
if (-f $filename) {
push(@file,$filename);
} elsif (-d $filename){
push(@dir,$filename);
}
}
#pp \@file,\@dir;
print "@dir";
【问题讨论】:
标签: perl