ok, last post for me on this thread :)
Here's a quick rewrite to illustrate some above the above points (and a few extras, like the hash-slice/map/chomp/splice line).. the Template usage is probably overkill, but a good example if this is going to move to a larger project.. (again, this isn't "right" or yours "wrong" just different ways to do stuff--which makes this fun and why i went nuts on this thread :) )
#!/usr/bin/perl -Tw use strict; use CGI qw(:standard); use Date::Calc qw/Month_to_Text/; use Template; my $employee=param('employee_name') || ''; my $filename = "Files/$employee.txt"; open(JOE, "$filename") or die "Couldn't read '$filename': $!"; my @data = <JOE>; close (JOE); my @certs; while(@data){ my %h; @h{ qw/certification month day year/ } = map {chomp; $_} splice(@dat +a,0,4); $h{monthStr} = Month_to_Text($h{month}); push @certs, \%h; } my $data = { employee => $employee, certs => \@certs, }; my $template = Template->new(); print header; # use Data::Dumper; # Use this for debugging # print "<pre>".Dumper($data)."</pre>"; # to see what $data is. $template->process(\*DATA, $data) or die $template->error(); exit; __DATA__ <html> <head> <title>Employee Certifications</title> </head> <body bgcolor="cccccc"> Employee's name is <b>[% employee %]</b><p/> <hr> <p/> [% FOREACH row = certs %] Certification is [% row.certification %] on [% row.monthStr %] [% row. +day %] [% row.year %]<p/> <HR> [% END %] <div align="center"> <table width="120" border="1" cellspacing="2" cellpadding="0"> <tr><td align="center">To go Back</td></tr> <tr><td align="center"><a href="http://hawaiicivilmarriage.com/FFD/">C +lick Here</a></td></tr></table><p></p></div> </body> </html>

In reply to Re: Change number into month by davidrw
in thread Change number into month by loop362

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.