>type slugger.pl use strict; use warnings; use List::SomeUtils qw(sort_by); use Data::Dumper; my @strings = ( "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", ); my @sorted_strings = sort_by {/search(.+)\?/;$1} @strings; print Dumper(\@sorted_strings); >perl slugger.pl $VAR1 = [ 'http://myurl.com/search/stringA?SomeMoreStuffA', 'http://myurlC.com/search/stringA?SomeMoreStuffXYZ', 'http://myurlA.com/search/stringB?SomeMoreStuffB', 'http://myurlB.com/search/stringC?SomeMoreStuffX', 'http://myurl.com/search/stringZ?SomeMoreStuffZZZ' ]; >
In reply to Re: Sorting on identical values
by BillKSmith
in thread Sorting on identical values
by slugger415
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |