in reply to Re: criteria based array sorting
in thread criteria based array sorting

zentara,
It appears you have a typo in that there is an overlap with 'r'..'z' and 'a'..'s' but it shouldn't cause a problem. Personally, I would steal a page from broquaint's bag of tricks:
#!/usr/bin/perl use strict; use warnings; my @unsorted = ( qw (Psdf lPik Easd aKwe SSdf eqwer scfgh Oegb rqwer T +) ); my %order = map {$_ => /[r-z]/ ? 'A' : /[a-q]/ ? 'B' : /[R-Z]/ ? 'C' : + 'D'} ('a'..'z', 'A'..'Z'); my @sorted = map { substr($_ , 1) } sort map { $order{ substr($_,0,1) } . $_ } @unsorted; print "$_\n" for @sorted;
Cheers - L~R