Tabs to spaces
From JmPm
(Difference between revisions)
m (Protected "Tabs to spaces": spam [edit=autoconfirmed:move=autoconfirmed]) |
m (Unprotected "Tabs to spaces": global protection) |
Current revision as of 17:34, 18 March 2007
sub Tab2Space { my ($line) = @_; $line =~ s/^\t/ /; # 8 leading spaces if initial tab while ($line =~ s/^([^\t]+)(\t)/$1 . ' ' x (8 - length($1) % 8)/e) { } # replace each tab with right num of spaces return $line; }