in reply to Re^2: removing redundantwhitespace
in thread removing redundantwhitespace
I thought I caught that case but, as you suggest, the white space on the end of the line is hard to see! The following simplifies the regex and fixes that case at the cost of complicating the substitution:
$str =~ s/((^|\s)\s*)/length ($2) ? (-1 < index ($1, "\n") ? "\n" : ' +') : ''/ges;
Oh, and it replaces tabs with spaces.
|
|---|