Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Wanted: humanly readable `script` output

by moritz (Cardinal)
on May 04, 2008 at 20:03 UTC ( #684470=note: print w/replies, xml ) Need Help??


in reply to Re: Wanted: humanly readable `script` output
in thread Wanted: humanly readable `script` output

You can replace the while loop with this little regex:
$text =~ s/.\x08//g;

Replies are listed 'Best First'.
Re^3: Wanted: humanly readable `script` output
by GrandFather (Sage) on May 05, 2008 at 01:43 UTC

    Not really. Consider:

    my $text = "No \x08\x08\x08 good"; $text =~ s/.\x08//g; print $text;

    Prints:

    No good

    Perl is environmentally friendly - it saves trees

      This problem with the way /g works is fixed with the 1 while hack

      [james@adajio ~]$ cat test.pl #!/usr/bin/perl my $text = "No \x08\x08\x08 good"; 1 while $text =~ s/.\x08//; print "$text\n"; [james@adajio ~]$ ./test.pl good [james@adajio ~]$

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://684470]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2016-12-05 09:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (75 votes). Check out past polls.