in reply to promoting array to a hash
That is, use a negative lookahead to check the word doesn't appear again. Saves you joining, splitting, grepping, and mapping :). I have not benchmarked it, though.print "$_\n" for sort <> =~ /\b(\S+)\b(?!.*\b\1\b)/g
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: promoting array to a hash
by sleepingsquirrel (Chaplain) on Jun 14, 2004 at 17:10 UTC |