Don-
Not sure if anyone has replied to you but here's my $.02:

That's nearly the perfect first perl programming task. You need to look into
using the system command or `` (backticks) to get system commands into a
variable or readdir to read the contents of a directory. Look at arrays &
sort to sort your array of filenames. Look at Push, Pop, & split for ways to
take apart & build arrays as well as break apart your | separated string.
Then comes the HTML output. You should look at the CGI module. You can craft
object oriented code for just simple print statements for the output once
the right header is in place. The docs for CGI are quite extensive.

Break your process apart and go step by step. As you run into specific
hang-ups, post back here.

Good luck.

~Mike

PS. And maybe come up with a more informational subject line.


-----Original Message-----
From: Don Doucette [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 16, 2005 7:43 PM
To: beginners-cgi@perl.org
Subject: hello all

hello everyone.
my name is don doucette and I am 38 years old and have been involved with 
computers since the Timex Sinclair.

I have recently set up a server and am hosting a web site and forum for my 
community association.

I am running the YaBB forum (http://www.yabbforum.com/) and I would like to 
do the following...

I would like to use perl to look in a directory of numerical named .txt 
files (as in 0123456789.txt), find the file name with the largest number 
(as in 1234567890.txt is greater numerically than 0123456789.txt) then open 
the file and extract data from that file so it can be posted into a web
page?

For instance...
I have a directory named Messages, in this directory there are the 
following files...

1108577587.txt
1108519222.txt
1108490078.txt
1108489912.txt

Obviously 1108577587.txt is greater numerically than the rest, this also 
happens to signify that this is the newest message. In this file is the 
following information...

Title of Post|Author|[EMAIL PROTECTED]|02/16/05 at 
12:13:07|Group|xx|0|192.168.1.1|Message||

As you can see this file is delimited by | and ends with ||
I would like to parse out the Message field first then the Author field and 
assign their value to a variable then insert the variable into html on a
page.

Something like...
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<p>Here is the newest post to the forum<BR><BR>
$Message <BR><br>
Posted by $author </p>
</body>
</html>

The idea is when the main web page loads it always shows the newest post to 
the forum and who posted it.

My question REALLY is do you think this can be easily done or is this a 
huge programming effort for someone just trying to figure out perl... I 
have been thumbing through my Perl book (The Complete Reference Perl Second 
Edition) but it hasn't really been helpful so far.

Thanks for your advice.




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to