in reply to most efficient regex to delete duplicate words
Yields: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";
alpha beta gamma foo bar baz qux foo gamma baz bar beta alpha qux
/\/\averick
perl -l -e "eval pack('h*','072796e6470272f2c5f2c5166756279636b672');"
|
|---|