Either the code you posted is different in some details from the code you're running, or else the running code never actually produces any output that includes "Certification is ..."

The problem would be easy to spot if you used proper indenting in your "if", "elsif", "else", "for" and "while" blocks. Here's how the last chunk of your code looks when properly indented (with some condensing and removal of unnecessary stuff to make it shorter):

if ($lines <= 0) { #print "has no records at this time."; print "<p\/><hr><p\/>"; while ($lines >=1) { $certification = shift(@data); print "Certification is $certification on "; my $number = shift (@data); $month = $mon [$number-1]; $day = shift (@data); $year = shift(@data); $mo_yr = shift(@data); print "$month $day $year $mo_yr<p/><HR>"; $lines--; } }
When the "if" and "while" blocks are bracketed that way, the condition for the "while" loop can never be met. Either remove the initial "if" statement there, or else move the "while" block outside the "if" block. In either case, look for a text editor that has a suitable mode for programming, and will do indentation for you (emacs and vi are the most popular examples, there are others).

In reply to Re: Opening files in a loop by graff
in thread Opening files in a loop 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.