Perl-Sensitive Sunglasses | |
PerlMonks |
Sorting on identical valuesby slugger415 (Monk) |
on Aug 08, 2019 at 17:15 UTC ( [id://11104187]=perlquestion: print w/replies, xml ) | Need Help?? |
slugger415 has asked for the wisdom of the Perl Monks concerning the following question: Hello Perl monks, I am in need of some sorting cleverness. I have a list of long strings that includes URLs and other bits, e.g.
I want to sort on just the strings between /search/ and the ? character, e.g.
(Note that rows 1 and 4 above will have identical $searchString values.) But I also want to keep a reference to the full original URL string and anything else in the string. I can obviously create an array with the $searchString values and sort that, but how do I map them to the original full string? I can't use a hash, since there are often duplicates (e.g. rows 1 and 4 above, both 'stringA'). Any thoughts? Thanks much as always. Scott
Back to
Seekers of Perl Wisdom
|
|