For Laurent: yes is exactly what I need, but I don't understand few codes:

Why do you execute:

Code

chomp $qpar;

the you repeat chomp in next instruction code?

Code

$qpar .= <DATA> and chomp $qpar while ($qpar !~ /;\s*$/);

what is ".=" ?

for rovf: sorry, maybe I was just confusing to explain. I have a log file where all the relevant lines have word "SUB" at the beginning of line (but not the first characters) and ending with semicolon. In some case this line is split on more lines, so I have this string start at line and end in the next line (where semicolon is). I have to "normalize" this situation before to print them. Last problem is that ";" could have a "\n", or not (if it's at the end of file, whitout any other line next).

In this case, I would ignore the \n completely. Just find SUB, followed by any text, up the next semicolon. You just need to make sure that the dot matches the newline, otherwise your pattern will faile. I.e. you need something like

This says: if $qpar does not end with a semi-colon (;) possibly followed by some spaces, then get the next line of input, concatenate it with the current $qpar, chomp the new $qpar (this is needed since a new line was added at the end of $qpar, you need to remove the new line characters again), and do all this as long as the new line you get is not ended by a semi-colon.