$_ = join "", map { $_ . " " x (8 - length() % 8) } split /\t/, $_, -1;Update:blakem points out that this code is broken. It will pad all parts of the string to a multiple of 8, including the last one. Getting it not to is disappointingly awkward..

Right, I was hurrying to put it up and leave. &nbsp Forgot to point out it only works for normal input files where each line ends in a newline.

Actually, your algorithm solves the problem without abandoning regexen. &nbsp Unless we're missing something, Larry was thinking along the lines of bart's logic above, that you have to know the new length of the line up to this point. &nbsp But you are just depending on the text in front of the present tab(s) to be aligned either with the beginning of the line or the previous tab stop, so there is no need to consider the entire preceding line segment: