这个问题在这里已经有了答案:
11 年前关闭。
Possible Duplicate:
How can I list all of the files in a directory with Perl?
我想遍历所有包含在同一目录中的几百个文件。我将如何在 Perl 中做到这一点?
最佳答案
#!/usr/bin/perl -w
my @files = <*>;
foreach my $file (@files) {
print $file . "\n";
}
在哪里
@files = <*>;
可
@files = </var/www/htdocs/*>;
@files = </var/www/htdocs/*.html>;
等等。
关于perl - 如何遍历 Perl 目录中的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2149368/