On Fri, 01 Feb 2002 18:52:18 -0500,
Steven Rubin <[EMAIL PROTECTED]> wrote:
> Create a script that formats a txt file into html. Well, that's
> kinda vague. I mean...
If the text files looks like the one you have below, with entries
separated by blank lines, here's a rough outline of what you could do:
Hope this helps,
Briac
#!/usr/bin/perl -Tw
use strict;
use CGI qw(:standard);
my @entries;
{
local $/ = ''; # Paragraph reading mode
while (<DATA>){
chomp;
my @datas = split(/\n/, $_);
push( @entries, [@datas] );
}
}
use Data::Dumper;
print Dumper @entries;
print header(), start_html('CGI people'),
table(
map { Tr(td([@$_])) } @entries
),
end_html();
__DATA__
Steven
http://blah.com
Web design and basketball
USA
Bill
http://bill.org
Butterfly chasing and Database administration
USA
__END__
--
briac
<< dynamic .sig on strike, we apologize for the inconvenience >>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]