标题:
[分享]比较两种直接输出目录的方法
[打印本页]
作者:
cnangel
时间:
2004-7-3 18:15
标题:
[分享]比较两种直接输出目录的方法
一种函数输出
#!/usr/bin/perl
print "Content-type: text/html; charset = gb2312\n\n";
opendir (DIR, ';.';);
@filelist = readdir(DIR);
close DIR;
foreach (@filelist)
{
print $_ . "<br>\n";
}
复制代码
另外一种模块输出
#!/usr/bin/perl
use strict;
use File::Find;
print "Content-type: text/html; charset = gb2312\n\n";
my $path = ".";
find(\&process, $path);
sub process
{
print $File::Find::dir, "$_<br>\n";
}
exit;
复制代码
欢迎光临 星星博客 (http://commerce.huhoo.net/)
Powered by Discuz! 7.0.0