Think about Loose Coupling | |
PerlMonks |
Re^8: list of unique strings, also eliminating matching substringsby LanX (Saint) |
on Jun 02, 2011 at 15:05 UTC ( [id://907814]=note: print w/replies, xml ) | Need Help?? |
I had a similar idea but with some modifications: 1. starting with the longest string and continuing in descending order 2. then only appending the non-embeddable strings to $all like this $all is in average significantly shorter and the tests with index should be faster. I'm also wondering if the reallocation of new memory when appending to $all could be avoided by starting with a maximal length string and then shortening $all again. Maybe uniq() from List::MoreUtils is faster or could be completely avoided (after sorting identical strings always appear in a sequence) All of this highly depends on the nature of the unknown data and should only be tested with identical sets... Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|