in reply to Two loops

You don't need nested loops to do what (I think) you are attempting to do. Since you are shifting information out of the @data array within the loop anyway, you would probably have more luck using a single while loop. Sort-of like this:
while(@data){ my $certification = shift(@data); # etc.. blah blah print "<p\/><HR>"; }