open(FILE, "<" , \$lines); while () { chomp; # strip record separator if(/\)$/) { $f=2; } if (/^\*/) { $f=1; } if ($f == 1) { print $_; } if ($f==2) { chomp; # strip record separator print " " . $_ . "\n"; } }