XP is just a number | |
PerlMonks |
Re: How to remove duplicate characters in a string in placeby kcott (Archbishop) |
on Feb 22, 2016 at 06:43 UTC ( [id://1155791]=note: print w/replies, xml ) | Need Help?? |
G'day punitpawar, "Is there a way by making use of s/// ..." You're starting with a solution and then trying to make it fit a problem. This is back-to-front: start with a problem and then find an appropriate solution. The output of your second example (cdghijkmnoestsr) contains an 'e' which shouldn't be there: the original string (abcdeffghijkllmnoppqestqaserb) contains three 'e's. As others have already noted, s/// does not seem appropriate. Here's how I might have tackled this problem:
Output:
— Ken
In Section
Seekers of Perl Wisdom
|
|