Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

by 2teez (Vicar)
on Jan 30, 2016 at 23:26 UTC ( #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
Node Status?
node history
Node Type: note [id://1154095]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2021-04-11 02:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?