in reply to Sorting a subset

In your example the second for loop will sort based on the numerical value of array elements with the first character chopped off. If that is what you want then something like this will work:
for my $ref (sort {substr($a,1) <=> substr($b,1)} grep {substr($_,0,1) + eq 'A'} @array) { #whatever with $ref }
If you want to sort asciibeticly just use sort. You don't need to do the substr since the first letter will be 'A' already.
for my $ref (sort grep {substr($_,0,1) eq 'A'} @array) { #whatever with $ref }
A substr will be faster than doing a regex but if you want to make it short you could also write it like this.
for my $ref (sort grep /^A/, @array) { #whatever with $ref }

--

flounder