in reply to remove duplicates
If not, doing a split on whitespace, using each list element as a hash key and flattening the result with keys() will give you the list of unique words.
HTH!my $string = "foo bar ..."; my %L; map($L{$_}++, split(/\s/, $string)); # bonus: each hash element has the number of occurrences as value. $string = join(' ', keys(%L));
--
Cheers, Joe
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re2: remove duplicates
by blakem (Monsignor) on Oct 11, 2002 at 08:14 UTC |