in reply to Help with creating output to screen...

Your datafile makes it look as though "PER" and "EMP" are on lines separate from the data, but
{ @data = &quotewords('\s+', 0, $_); } if ((/^PER\s*$/) && ($data[0]) && ($data[1]) && ($data[2]) && ($data +[3]))
makes it look as though you might sort of think they are on the same line. I think you need to do the following (expressed as pseudocode; you still need quotewords, etc.):
while (<>){ last if EOS if (PER){ read a PER line and process it } elsif (EMP){ read an EMP line and process it } }
HTH, --traveler