You have two main problems, how to parse the data into records and then how to generate html from those records.

I'll get you started with a simple parser. Not perfect, but a start.
Read about the CGI module (do a google search on CGI Perl) and adapt this to start generating html code.
Report back when you've made some attempts at that.

#!/usr/bin/perl -w use strict; use Data::Dump qw(pp); my %record=(); while (<DATA>) { if (/^Name/) { fill_in_record($_); process_record(); %record=(); } } sub fill_in_record { my $line = shift; while ( (defined $line) and $line !~ /^\s*$/ ) #stop on next blank #line or EOF { my ($id, $value) = split(' ',$line); chop $id; #this deletes the trailing ':' character $record{$id} = $value; $line =<DATA>; } } sub process_record { print "call cgi subroutine to process\n"; print pp (\%record),"\n"; print "\n"; } =prints call cgi subroutine to process { Name => "joe", age => 23, phone => 3423423 } call cgi subroutine to process { Name => "sam", age => 23, phone => 4343433 } call cgi subroutine to process { Name => "ram", ag => 45, phone => 34234232 } =cut __DATA__ some lines of code blah blah blah blah Name: joe age: 23 phone: 3423423 Name: sam age: 23 phone: 4343433 Name: ram age 45 phone: 34234232 some more lines.. blah blah..

In reply to Re: Read block of file and print to html table by Marshall
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.