jbroder
01-29-1999, 03:26 PM
Now that I have formmail set up on futurequest LOTS of people send me files to post on my site. It is getting really annoying rewriting the table that holds the lins to there files. So, I took a perl class
and wrote a script (my first!) that reads the directory and provides links to each file.
http://www.guitartricks.com/cgi-bin/11.cgi
Here is the script, which works fine as far as I can tell:
##########################################
#!/usr/local/bin/perl -w
print "Content-type: text/html\n\n";
print '<html>' ;
print "whoo!!!
" ;
opendir (HTDOCS,"/big/dom/xguitartricks/jbroder/www/your/") ;
foreach (readdir(HTDOCS)) {
if ($_=~/\.html$/) {
print "<a href=\"http://www.guitartricks.com/your/$_\">$_</a>
" ;
}
}
print "<img src=\"http://guitartricks.com/images/gtban.gif\">" ;
print '</html>' ;
###########################################
This is quite a plain doc and I would like to make it more informative.
My question is how do I take each file name
and search thru that file to find the text between the <h2></h2> tags and print it to
the screen right next to the link? It would
then say something like
your12.html contributed by Jon Doe from Canada.
I have tried to setup readdir(YOUR) as an array and I have tried to just use
foreach ($_){
if (/h4/){
print "" ;
}
}
but have had no luck.
Thanks in advance.
Jon
------------------
guitartricks.com
and wrote a script (my first!) that reads the directory and provides links to each file.
http://www.guitartricks.com/cgi-bin/11.cgi
Here is the script, which works fine as far as I can tell:
##########################################
#!/usr/local/bin/perl -w
print "Content-type: text/html\n\n";
print '<html>' ;
print "whoo!!!
" ;
opendir (HTDOCS,"/big/dom/xguitartricks/jbroder/www/your/") ;
foreach (readdir(HTDOCS)) {
if ($_=~/\.html$/) {
print "<a href=\"http://www.guitartricks.com/your/$_\">$_</a>
" ;
}
}
print "<img src=\"http://guitartricks.com/images/gtban.gif\">" ;
print '</html>' ;
###########################################
This is quite a plain doc and I would like to make it more informative.
My question is how do I take each file name
and search thru that file to find the text between the <h2></h2> tags and print it to
the screen right next to the link? It would
then say something like
your12.html contributed by Jon Doe from Canada.
I have tried to setup readdir(YOUR) as an array and I have tried to just use
foreach ($_){
if (/h4/){
print "" ;
}
}
but have had no luck.
Thanks in advance.
Jon
------------------
guitartricks.com