[H-GEN] A perl query
Three Blokes
gerbil at bigpond.net.au
Fri May 2 21:37:15 EDT 2003
[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]
Morning Everyone :),
I decieded, in my spare time, to learn perl and the project I chose as my
learning experience is to process some Quake 3 log files and output the
statistics to html.
So far, so good, it's spitting out the statistics to screen, and my html is
made, iv even got perl to write the statistics to the html, But all good
things must end, and so my problem: I have been reading the source html line
by line(e.g $lineofhtml = <HTMLFILEHANDLE>) doing a search and replace to
insert the data coming from my logfile, and then writing to the output
directory with print $lineofhtml; which works fine, except for the fact that
it misses some lines!!, now i'm assuming that it's skipping lines because
they have Special Characters in them(although it skips a line that just has
<head> written on it, which as far as I can see doesnt have any special
characters on it?) so my question to anyone who knows perl is this: I could
use read() to read the entire file into a scalar, then search and replace
it, then write() it back to the output, is this a good idea?, is there a
limitation on the size of a scalar that could cause problems when my output
reaches a certain size?, and finally, will this overcome the special
character problem im having currently?, in everything i'v read so far they
say that read() will read a certain amount from a file, but doesnt specify
whether the data will contain special characters or not?
Any help will be greatly appreciated, and of course i'm completely open to
any other ways people can think of that I could do this, along with
criticism and/or flames.
Thankyou,
Joe Skilton
--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'. See http://www.humbug.org.au/
More information about the General
mailing list