Perlでディレクトリ一覧を表示するcgi

#!/usr/bin/perl -w
use CGI;

# 指定したディレクトリ内の該当ファイル名一覧

print "Content-type: text/html\n\n";
print "This cgi file name is test cgi
\n"; opendir(DIR, './'); while (defined($dir = readdir(DIR))) { if( $dir =~ /^\./ ){ next;} print "$dir
\n"; } closedir(DIR);

ってなものを書きました。
ちょっとしたメモです。