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.
http://myurl.com/search/stringA?SomeMoreStuffA http://myurlA.com/search/stringB?SomeMoreStuffB http://myurlB.com/search/stringC?SomeMoreStuffX http://myurlC.com/search/stringA?SomeMoreStuffXYZ http://myurl.com/search/stringZ?SomeMoreStuffZZZ
I want to sort on just the strings between /search/ and the ? character, e.g.
$URL =~/search/(.+)\? my($searchString) = $1;
(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
In reply to Sorting on identical values by slugger415
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |