On 4/25/06, Nikolas Britton <[EMAIL PROTECTED]> wrote:
> 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";
>

This works... but it's clunky:

my $string = "letter";
my @chars = split("", $string);
$string = ""; @chars = sort (@chars);
foreach (@chars) {
$string .= $_;
}
$string =~ tr///cs;
print "$string";


--
BSD Podcasts @ http://bsdtalk.blogspot.com/
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to