merlyn gave a good answer, so I'm going to point to another issue (which you've obviously recognized, because you asked the question).

Whenever you see a pattern emerge in your code, look for an opportunity to refactor your code into something that more naturally reflects what your code is trying to do. For example, the entire chunk of code that you have from "use strict" down to assigning to the $row variable can be reduced to the following:

use strict; use CGI qw/:standard/; print header; my ( $off_shift1, $off_shift2 ); my $date = param("date") || ''; my $employee = param("employee") || ''; my $sshift = param("sshift") || ''; my $eshift = param("eshift") || ''; my $name = td( $employee ); # Calculate On shift hours and generate table cells my $total_shift = $eshift - $sshift; my $on_shift = td( 'd' ) x $total_shift; # ??? # Calculate Off Shift hours and generate cells my $td = td(''); if ( $sshift > 7 and $sshift < 25 ) { $off_shift1 = $td x ( $sshift - 8 ); } if ( $eshift > 7 and $eshift < 25 ) { $off_shift2 = $td x ( 24 - $eshift ); } my $row = "$name$off_shift1$on_shift$off_shift2";

That's a lot easier to read and maintain. Now, why did I test to ensure that $eshift and $sshift were in the correct range? Because validating your input data is almost always one of the first things you want to do. Read perlsec for more information about taint checking and ensuring that the data you read doesn't do horrible things to you later.

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.


In reply to (Ovid) Re: Help With Multiple Form Fields by Ovid
in thread Help With Multiple Form Fields by nlafferty

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.