while (<>){ last if EOS if (PER){ read a PER line and process it } elsif (EMP){ read an EMP line and process it } }