in reply to cleaning up multiple lines...

Hi Dave, Sorry I wasn't clear in my post. The piece of data below is from the sql. It's not a text datafile. So your solution doesn't work. This is the piece of code I used to retrieve data from the database and save the output into @records.
while ( $rec = $sth->fetchrow_hashref() ) { push @records, $rec; } @records now contains: name | passed | failed | pending ------+--------+--------+--------- xxx | null | 2 | null xxx | 30 | null | null xxx | null | null | 10 yyy| 6 | null | null