# Assuming space delimited words and removing duplicates # not necessarily next to each other my $str = "abc def abc hello def 123 abc"; my %count; $str =~ s/((\w+)\s?)/$count{$2}++ ? '' : $1/eg; print $str,"\n";
In reply to Re: most efficient regex to delete duplicate words
by runrig
in thread most efficient regex to delete duplicate words
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |