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

Re: Descending Sort

by mkmcconn (Chaplain)
on Nov 05, 2001 at 11:45 UTC ( [id://123293]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $adata =   q(athings1 athings2);
    my $bdata =   q(bthings1 bthings2);
    ...
        my ($sortby,$astring,$bstring) = @_;
        # this function uses three arguments.
    }
    
  2. or download this
    
    if ($sortby eq "string"){
       my $result = sort { $b cmp $a } ($a_items[$item_no], $b_items[$item
    +_no]); 
    }
    # $result will contain the greater of the two values.
    
  3. or download this
    
        my @a_items  = split("\t", $astring,$limit);
    ...
        my @b_items = split("\t", $bstring,$limit);
    #discard the remainder
        pop @b_items;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-03-29 16:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found