CGIとかPerlとか超初心者なんだけど、
■ このスレッドは過去ログ倉庫に格納されています
0698nobodyさん
04/11/06 20:07:04ID:???あんまエレガントな書き方は出来ないけどこれでどうよ?
#!/usr/bin/perl
use strict;
use warnings;
my $target = "./aaa";
print "Content-type: text/html\n\n";
opendir(DH,"$target");
while(my $file = readdir(DH)){
next if($file =~ /^\.+$/);
my $path = "$target/$file";
if(my $title = GetTitle($path)){
print qq|<a href="$path">$title</a><br>\n|;
}
}
closedir(DH);
sub GetTitle($){
open(FH,"< $_[0]");
while(<FH>){return $1 if(m|<title>([^<>]*)</title>|i);}
close(FH);
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています