CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
use Perl to generate index.html

 



allensim81
New User

Aug 11, 2009, 2:42 AM

Post #1 of 2 (433 views)
use Perl to generate index.html Can't Post

Hi, i am new in perl.
I am trying to write a simple script to show an index.html.
however it works only 20%! only one item is shown in the index.html... can u please guide me step-by step? thanks in advance!


Code
 #!/usr/bin/perl$httrackpath = "/usr/local/bin";$websites="/data/websites";opendir(DIR, $websites);@files=readdir(DIR);closedir(DIR);for $file(@files) {        ## List all files and directories from /data/websites ##        next if ($file =~ /^\./); # Ignore anything start with dot "."        next if (!-d "$websites/$file");  # Ignore if it is not a directory        next if ($file =~ /hts-cache/); # Ignore if it is hts-cache dir        print "[$file]\n";        open(HTML, ">/root/index.html");    print HTML "<html>\n<head>\n<title>$base$i</title>\n</head>\n<body>\n";    print HTML "<a href=\"$base$next.html\"><img src=\"$base$i.jpg\"></a>\n";    print HTML "</body>\n</html>\n";    print HTML "< <A HREF=\"$file/index.html\">$file</A>";    close(HTML);        ## proceed with the next function ##        ## End, next website ##} 



KevinR
Veteran


Aug 11, 2009, 10:11 AM

Post #2 of 2 (428 views)
Re: [allensim81] use Perl to generate index.html [In reply to] Can't Post

Please edit you post to break up that long line. Your question already has answer posted on Tek-Tips.
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives