in reply to Appending lines starting with white space to the previous line
while(($_ = scalar <>)) { # remove the new line from that line. chomp; if ( /^\s+/ ) { # if there is no previous line then print the warning and cont +inue reading the next line., if ( not defined $cur_line ) { warn "continuation of no previous line\n"; next; } # since it is a continuation line, concatenate it with the previous +line., $cur_line.=$_; } else { # if the line does not contains the tab, then take that line a +s the current line., if (defined $cur_line) { # print the concatenated line. print $cur_line . "\n"; } # store the current line in the variable $cur_line = $_; } }
|
|---|