I'd use a hash-slice (if order doesn't matter)
Debugger demo:
DB<3> p $a olivia-niels-peter-lars-niels-lars-olivia-olivia DB<4> @hash{ split '-',$a } = () DB<5> x keys %hash 0 'lars' 1 'niels' 2 'peter' 3 'olivia' DB<6> p join '-', keys %hash lars-niels-peter-olivia DB<7>
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
In reply to Re: How can I make a string unique (quicker than my approach at least)
by LanX
in thread How can I make a string unique (quicker than my approach at least)
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |