in reply to Re: should this backspace removal code be done better?
in thread should this backspace removal code be done better?

tr/\b//d would probably be the most efficient form but s/\010//g will also do the job. What is with all the .\010 and while(1)'s in the replies?

$_ = "hello\b\b\b\b\b\b\hello\b\b"; tr/\b//d; print length($_), $/, $_, $/; __DATA__ 10 hellohello

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Replies are listed 'Best First'.
Re: Re: Re: should this backspace removal code be done better?
by BrowserUk (Patriarch) on Oct 05, 2003 at 15:19 UTC

    You miss the point or I do.

    When you remove the \b, you also have to remove the character behind it over which it backspaced. In your example, the final output should be something like "hel".


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
    If I understand your problem, I can solve it! Of course, the same can be said for you.