in reply to Module for sets of strings, ordered, case-insensitive?
I'd combine two data structures an array (holding the sequence of $strings ) and a hash with lc($string) => arr_pos pairs ° which are initialized in the ->new constructor.
Then
Doesn't look that difficult to me...
Or am I missing something?
°) In case your strings are not unique, you'll need a HoA lc($string) => [ @arr_positions ] holding multiple positions. Of course ->after would need to check all previous positions then.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Module for sets of strings, ordered, case-insensitive?
by LanX (Saint) on Dec 27, 2020 at 02:01 UTC |