in reply to Re: Sorting an array by dates in a field...
in thread Sorting an array by dates in a field...

O.K, sorry! Its 1:22am here and I'm not thinking straight! %P

I havent got the data yet so at the moment i'm just "simulating" 3 lines from the file being in the array:

#!/usr/bin/perl my @data; push @data, [ split (/\|/,"2001-07-07|12345|This is a test 1") ]; push @data, [ split (/\|/,"2001-07-08|23456|This is a test 2") ]; push @data, [ split (/\|/,"2001-07-06|34567|This is a test 3") ]; print $data[0][0];

So as you can see, at the end it prints "2001-07-07" which is the "first row, first column" of the array.

What I want to do is that this array and sort it by date in descending order using the date field.

By the way - what IS the proper term for these sorts of arrays in Perl and how do you refer to the "rows and columns" I always use? *S* I mean, what is it when you know how many "columns" you have but the number of rows (say its being read from a file) is variable?

- Jed