#!/Perl/bin/perl -w
$dir_name='C:\perl-test';
opendir(DIR, "$dir_name") || die "Cannot open $dir_name";
@a=readdir DIR;
foreach (@a) {
next if ($_=~/^\./);
print "$_\n";
}
closedir DIR;
#!/Perl/bin/perl -w
#$dir_name='C:\perl-test';
$dir_name="C:\\perl-test";
opendir(DIR, "$dir_name") || die "Cannot open $dir_name";
while ($name=readdir DIR) {
next if $name=~/^\./;
print "$name\n";
}
closedir DIR;
阅读(1620) | 评论(0) | 转发(0) |