$s = "The\tquick\tbrown\tfox\njumps\tover\tthe\tlazy\tdog";; print $s;; The quick brown fox jumps over the lazy dog ($t=$s); $t =~ s[([^\n]+\n?)]{ my$l=$1; 1 while $l=~s[(\t)]{ '.'x(8-($-[0] % 8))}e; $l}ge; print $t;; The.....quick...brown...fox jumps...over....the.....lazy....dog