Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Sorting a subset

by tcf22 (Priest)
on Dec 12, 2003 at 18:52 UTC ( #314383=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @array = qw(Art bob joe andy willy Andrew john Archie);
    foreach(sort {substr($a,1) cmp substr($b,1)} grep /^A/, @array){
    ...
    Andrew
    Archie
    Art
    
  2. or download this
    foreach(sort {substr($a,1) cmp substr($b,1)} grep {substr($_,0,1) eq '
    +A'} @array)
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://314383]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2020-07-08 05:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?