Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re:^3 Remove repeated characters from a string

by knew (Monk)
on May 13, 2004 at 15:12 UTC ( [id://353097]=note: print w/replies, xml ) Need Help??


in reply to Re:^2 Remove repeated characters from a string
in thread Remove repeated characters from a string

This will do that for you:

1 while $string =~ s/(.)(.*)\1/$1$2/g

Replies are listed 'Best First'.
Re^4: Remove repeated characters from a string
by aramisf (Beadle) on Apr 10, 2014 at 18:24 UTC
    This construction with the while loop made my day. Thanks a lot, sir knew! :D

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://353097]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2025-06-17 14:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.