in reply to most efficient regex to delete duplicate words

Here's a non regexp solution. I'm assuming that the 'separator' between the words is unimportant. This will also remove duplicates that are not 'next to' each other within the string. Ie. The regexps here won't remove the second alpha from "alpha beta alpha".
my $string = "alpha beta beta gamma gamma gamma foo bar bar baz qux +qux qux"; # preseving the order my $i; my %h = map { $_ => $i++ } split(/[\b\s]+/,$string); print join(" ", sort { $h{$a} <=> $h{$b} } keys %h); print "\n"; # destroying the order my %h = map { $_ => 1 } split(/[\b\s]+/,$string); print join(" ",keys %h); print "\n";
Yields:
alpha beta gamma foo bar baz qux foo gamma baz bar beta alpha qux

/\/\averick
perl -l -e "eval pack('h*','072796e6470272f2c5f2c5166756279636b672');"