in reply to please help multiple lines parsing

This is a very common situation when "parsing" text files that contain multi-line "records". In general, there are three basic methods of attack:

Abigail's suggestion would work best using the third approach:

$/ = undef; $_ = <>; s/(\n)(header)/$1.$2/g; # (updated: made sure not to lose \n) s/\n\+/ /g; # (updated: forgot to escape the "+") print;
The list above is ranked in terms of "hardest-to-easiest", and your choice of method should be a matter of picking the easiest one that can do what needs to be done.