Perl: sort string alphabetically, or remove dupe chars?

Nikolas Britton nikolas.britton at gmail.com
Tue Apr 25 22:47:59 UTC 2006


basically what I want to do:

my @wordlist = (letter, remember, alphabetically);
## some whizbang code that changes words like
## "letter" to "eelrtt", remember to beeemmrr,
## and alphabetically to aaabcehilllpty.
@foobar =~ tr///cs; #hmm, doesn't work.
print "@wordlist\n";

Hmm, that's broke, how about this:

my $wordlist = "letter";
## some whizbang regex that removes dupe chars
## from words like "alphabetically" --> "alphbeticy".
print "$wordlist\n";


Thanks.
--
BSD Podcasts @ http://bsdtalk.blogspot.com/


More information about the freebsd-questions mailing list