in reply to Two loops

Your code looks somewhat screwed and makes not much sense to me. It seems you want to format a date.
Please tell us what @data contains and what output you expect. I'm sure some monk will come up with a solution that fits into a single line.


holli, /regexed monk/

Replies are listed 'Best First'.
Re^2: Two loops
by loop362 (Pilgrim) on May 27, 2005 at 04:39 UTC
    Aloha,
    I read all the data (from a file) into an array. There are 5 lines to each set. (I actually will only print 4) So I want to read 5 lines then increment then look and see if there is 5 more if there are read and print them, until I've exausted the file (which won't be too big). Somehow I get four lines, two with valid data and two more sets with only one line in each set and data that really looks weird.

    Mahalo, for your time. Joseph W. Guillaume

      I'm not sure I get what it is you're trying to do... However, to the extent that I think I know, try the following:
      for (1 .. int(scalar @data / 5)) { my $certification = shift(@data); my $number = shift(@data); my $month = $mon[$number - 1]; my $day = shift(@data); my $year = shift(@data); my $mo_yr = shift(@data); print "Certification is $certification on $month $day $year <p\/><H +R>\n"; }

      I'm guessing that there is a better way of doing this, but without knowing what the rest of the script is doing...

      --greg