Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: How to remove all repeating characters in a string in place

by 2teez (Vicar)
on Jan 30, 2016 at 23:26 UTC ( [id://1154095]=note: print w/replies, xml ) Need Help??


in reply to How to remove all repeating characters in a string in place

Hi,
...or any other way to do this ?

What about using tr/// you can do perldoc -f tr on your CLI to read the documentation.
The following works like you wanted:

perl -we "$ARGV[0]=~tr[abf]()ds; print $ARGV[0]" aaabbcdeffgh # prin +ts cdegh

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-04-16 17:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found