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):
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).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--; } }
In reply to Re: Opening files in a loop
by graff
in thread Opening files in a loop
by loop362
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |