Hi Jon,

Your script should look something like this:

#!/usr/bin/perl
use CGI qw( :standard );
open(LOGFILE, "logfile.txt") or die "Can't open logfile: $!\n";
while($line = (<LOGFILE>)) #
{
        chomp $line;
        push(@links, $line);
#This was the main problem. You were doing
# $line = $link which makes zero sense!
# Please read up on arrays and hashes and functions:
# push, pop, shift, unshift, keys, values and also foreach loops
# Also check out chomp, chop and substr while you're at it for basic string
manipulation
}


print header;
print <<End_Begin;
<html>
        <head>
        <title>Secondary navigation page</title>
        </head>

<body>
        <table border="0" cellpadding="2" cellspacing="0" width="100%">
End_Begin

foreach $link (@links)
{
        print <<End_Row;
        <TR>
        <TD><a href="$link">$link</a></TD>
        </TR>
End_Row
}

print <<End_Finish;
</table>
</body>
</html>
End_Finish
# end of program

-----Original Message-----
From: Jon Grant [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 19, 2001 3:32 PM
To: [EMAIL PROTECTED]
Subject: HELP!!! What's wrong with my app.??


Hi all,

I am a perl beginner and find myself somewhat stuck, please help!!

I am trying to write a program that will access a log file that has a list
of resource addresses. The program will then create an html page that
returns the last address from the log file as a link in an html page. I
attach the logfile and application as text files. I would be very grateful
if someone could have a look through my work and suggest where it is going
wrong or suggest some alternatives.

Any help will be very gratefully appreciated!



Cheers,

Jon.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to