Works with empty files and files that begin with a ;do { $n = chomp; print; $_ = <>; print $/ x $n unless s/^;//; } while defined($_);
Update: This is just another way to think about the problem. You don't have to start every file reading loop with while (<>).
Update 2: Changed unless /^;/ to unless s/^;// which addresses concerns about it not working with consecutive lines beginning with a semi-colon.
In reply to Re: append line to previous line in txt file
by pc88mxer
in thread append line to previous line in txt file
by mmittiga17
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |