my $dir = '/'; ## rem trailing slash
my $body; ## our file list
my $saveFile = '/dev/null'; ## file to save links
opendir( MYDIR, $dir ) or die 'opendir';
$body =
join( "\n", ## make it legible
map { '$_
' } ## format each file
sort { $a cmp $b } ## sort them
grep { ! /^\./ } ## no .name files
grep { -T "$dir$_ } ## only text files
readdir MYDIR
);
closedir MYDIR;
## build your link page
## using $body
open( FILE, $saveFile ) or die 'open';
print FILE <
My Files
$body
EOF
close FILE;