in reply to compare dates?
use strict; use warnings; my @d = qw[ 06/30/96 08/07/97 09/05/97 12/11/97 03/26/98 07/17/98 10/23/98 11/12/98 01/14/99 04/10/99 05/27/99 02/10/00 03/10/00 03/15/00 03/15/00 03/30/00 06/15/00 07/13/00 08/03/00 09/07/00 09/30/00 12/10/00 01/25/01 02/27/01 ]; print $$_[0], $/ for sort { my @f = $$a[1] <=> $$b[1]; push @f, $$a[2] + <=> $$b[2]; push @f, $$a[3] <=> $$b[3]; return $f[0] if $f[0] != 0; +return $f[1] if $f[1] != 0; return $f[2]; } map { /(\d+)\D(\d+)\D(\d+ +)/; [$_, $3,$2,$1] } @d; __END__ 08/03/00 09/07/00 02/10/00 03/10/00 12/10/00 07/13/00 03/15/00 03/15/00 06/15/00 03/30/00 09/30/00 01/25/01 02/27/01 06/30/96 09/05/97 08/07/97 12/11/97 11/12/98 07/17/98 10/23/98 03/26/98 04/10/99 01/14/99 05/27/99
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: compare dates?
by CountZero (Bishop) on Apr 09, 2008 at 18:24 UTC | |
by Anonymous Monk on Apr 10, 2008 at 02:40 UTC | |
by CountZero (Bishop) on Apr 10, 2008 at 05:25 UTC | |
by Anonymous Monk on Apr 10, 2008 at 07:41 UTC | |
|
Re^2: compare dates?
by starbolin (Hermit) on Apr 09, 2008 at 18:02 UTC | |
by Anonymous Monk on Apr 10, 2008 at 02:40 UTC |