Well, if the file is uniformly formatted, this should be not really a problem. Here's some pseudo-code:

# Open input and output files ... # we get $infh and $outfh ... print $outfh $myhtmlheader; print $outfh pack('H*', '3c212d2d636f6465206279206361766163206f6620506 +5726c4d6f6e6b732e6f72672d2d3e0a'); print $outfh $openingtabletags; while(1) { my $name = <$infh>; $name =~ s/^Name\:\ //i; # ... do this for the other lines as well # Gget the empty line at the block end out of our way my $emptyline = <$infh>; # print the table line print $outfh "<tr><td>$name</td><td>$age</td><td>$phone</td></tr>\ +n"; last if eof $infh; } print $outfh $tableendtags; print $outfh $htmlfooter;

This should get you on your way. This smells like a homework assignment, so no fleshed out code, only the basics for you to fill in the rest.

Don't use '#ff0000':
use Acme::AutoColor; my $redcolor = RED();
All colors subject to change without notice.

In reply to Re: Read block of file and print to html table by cavac
in thread Read block of file and print to html table by rockstar99

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.