|
Posted by Achim Peters on May 28, 2008, 11:38 am
Please log in for more thread options
valerie.seigneur@googlemail.com schrieb:
> I'd like to use "\b" to delete a tab character,
Whether it does or not depends on the terminal you print the tab and the
\b to. And other than possibly on the output device the tab is not
deleted anywhere, if at all.
> perl -e 'print "AB\bC\n";'
> works fine and prints "AC", but
> perl -e 'print "A\t\bC\n";'
> prints "A-tab-C".
Are you sure? I'd expect
"A-(n-1 spaces)-C"
where n is the number of spaces the tab was converted to.
> This is the simplified version, of course. In my script the extra tab
> is there because I'm printing a tab each time I go through a loop, but
> at the last iteration, I actually want a new line there, so I want to
> get rid of the tab character and replace it with "\n".
Wrong approach. Don't print the last tab in the first place.
BTW: You can see on your terminal, whether a line has a tab before the
\n or not? To me "abc\t\n" and "abc\n" look alike when printed: Nothing
to be seen in that line after the "abc" up until the right border of the
screen or window.
Bye
Achim
|