in reply to Sorting on identical values

You want a schwartzian transform. Basically
my @sorted_urls = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { m|/search/([^\?]+)\?|; [$_, $1] } @urls;


holli

You can lead your users to water, but alas, you cannot drown them.