in reply to How to remove duplicate characters in a string in place
#!/usr/bin/perl -l # http://perlmonks.org/?node_id=1155716 use strict; use warnings; my $input = "abcdefghiaabccdjklm"; my $want = "efghijklm"; print $input; $input =~ s/.(??{ -1 == index("$`$'", $&) && '(*FAIL)' })//g; print $input; print $want; $input eq $want and print "Match!";
hehehe
|
|---|