Howdy List :)

I have a list of strings that start with an uppercase B, Q, or Z

I need to sort them so they are in order of Q, B , then Z


my @sample_strings = qw(Bang Quiet Zing Zop Quid Boo);

I need them to be sorted as:

 Quid
 Quiet
 Bang
 Boo
 Zing
 Zop

I'd like to sort() them but can't figure a way to do that :)

So for now I've grepped out the Q's (using substr to match the beginning Q instead of regex, for speed ;p) then sort the leftover B's and Z's and add them to the end of the Q's list but that seems convoluted...

Any ideas or input on how to efficiently do that with sort() or even map() is most appreciated :) perldoc -f sort|-f map didn't appear to address this situation :(

The real array will have between 1 to 100 items, just FYI

TIA for any ideas :)

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to