Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: append data to previous lineby Laurent_R (Canon) |
on Apr 15, 2015 at 17:54 UTC ( [id://1123540]=note: print w/replies, xml ) | Need Help?? |
The approach offered by fishmonger is neat and clever.
Using your approach, it could be done with deferred printing (i.e. you print your stored line only when you know it has no continuation, i.e. when you have read the next one): This gives the following output: Well, fishmonger's solution is obviously simpler and better in this case, but I wanted to show how you could have proceeded, and this technique of deferred printing can be useful in many more complicated cases where redefining the input record separator would not solve the problem.
Je suis Charlie.
In Section
Seekers of Perl Wisdom
|
|