in reply to How can I make a string unique (quicker than my approach at least)
After wrapping it into a sub, it looks like this:
# Usage: LIST = RemoveDuplicates(LIST) sub RemoveDuplicates { my %seen; grep !$seen{$_}++, @_; }
Maybe somebody who is more knowledgeable can explain how this works, because I don't understand it myself. I just know it works. I tested it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How can I make a string unique (quicker than my approach at least)
by Athanasius (Archbishop) on Apr 03, 2024 at 04:21 UTC | |
|
Re^2: How can I make a string unique (quicker than my approach at least)
by Timka (Acolyte) on Apr 03, 2024 at 04:14 UTC | |
by Timka (Acolyte) on Apr 03, 2024 at 04:38 UTC | |
|
Re^2: How can I make a string unique (quicker than my approach at least)
by hippo (Archbishop) on Apr 03, 2024 at 08:14 UTC | |
by eyepopslikeamosquito (Archbishop) on Apr 03, 2024 at 09:17 UTC |