Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

How do I create a sort sub on-the-fly?

by CharlesClarkson (Curate)
on Nov 02, 2001 at 10:41 UTC ( [id://122757]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use strict;
    ...
        print $fh (join ',', @$_), "\n" for sort column_sort records;
    
    __END__
    
  2. or download this
    report:  sort lnum-a,source-a,hits-d,sip-d,time-a
    Monmouth,2000-05-2000:00:09-04,192.35.75.69,138,192.100.255,66,2,105,1
    +234
    ...
    Lewis,2000-03-1200:21:45-32,167.54.80.65,144,192.67.29,134,32,107,1487
    Hero,2001-01-0500:00:11-04,211.34.78.93,132,184.57.62.35,151,12,101,15
    +32
    Jackson,2000-01-0500:00:11-04,193.0.0.195,175,184.57.62.35,151,14,105,
    +153
    
  3. or download this
    sub column_sort {
        @$::a[8] <=> @$::b[8]
    ...
        @$::a[1] <=> @$::b[1];
    }
    1;
    
  4. or download this
            REQUEST FOR SORTING
    
    ...
    Meade,2001-01-0500:00:11-04,213.132.32,175,184.57.62.35,151,12,107,153
    +2
    Yuma,200-03-1100:00:12-05,210.0.0.0,156,192.78.54.21,156,10,105,1578
    Monmouth,200-04-1000:00:10-08,63.0.0.0,125,192.45.67.2,159,16,101,1879
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-24 19:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found