Functions of particular interest to you will be split and sort. Here's a code example to get you on your way.

#! /usr/bin/perl use strict ; use warnings ; $|++ ; # Read the data into a 2d array chomp( my @lines = <DATA> ) ; my @data = () ; foreach ( @lines ) { my @cells = split ; push @data, \@cells ; } # Sort the list by user. my @data_by_name = sort { $a->[0] cmp $b->[0] } @data ; # Sort the list by date & time. my @data_by_date = sort { $a->[3] <=> $b->[3] || $a->[4] <=> $b->[4] } @data ; __DATA__ u12345 x10 qwerty 20020725 1421 u12357 x11 asdf;; 20020727 1524 u12245 x12 perl 20020722 1941 u12145 x13 python 20020725 1825 u12945 x14 /bin/sh 20020724 1331 u12545 x15 grep 20020721 1921

_______________
D a m n D i r t y A p e
Home Node | Email

In reply to Re: Sorting big text lists by DamnDirtyApe
in thread Sorting big text lists by Infinity

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.