for my $ref (sort grep {substr($_,0,1) eq 'A'} @array) { #whatever with $ref }