Here is a shot using map. I moved the data around(basically in backwards so 
would know if sorted). Ran with warnings under as build 623:


my %DayOfWeek = ( 'jan', 1, 'feb', 2, 'mar', 3, 'apr', 4, 'may', 5, 'jun', 6,
                  'jul', 7, 'aug', 8, 'sep', 9, 'oct',10, 'nov',11, 'dec',12);

my @MyData = ();
while ( <DATA> ) {
   chomp;
   push(@MyData, $_);;
 }
                   
foreach my $MyKey (sort { $a->[3] <=> $b->[3] || $DayOfWeek{lc($a->[1])} <=> 
$DayOfWeek{lc($b->[1])} ||
                          $a->[2] <=> $b->[2] || $a->[4] <=> $b->[4] || $a->[5] <=> 
$b->[5] || 
                          $a->[6] <=> $b->[6] } map{ [ 
$_,/^[a-z0-9]+\|\w{3}\s+(\w{3})\s+(\d{1,2})\s+(\d{4})\|(\d{1,2}):(\d{1,2}):(\d{1,2})/i 
]} @MyData) {
   
   printf "%-s\n", $MyKey->[0];
 }

__DATA__
S02|Sun Feb 17  2002|7:13:18|831398|HLHack|UG-CS Central-Hell's Kitchen
S02|Sun Feb 17  2002|7:13:20|831398|HLHack|UG-CS Central-Hell's Kitchen
juihung|Sun Feb 17  2002|7:4:56|1149357|HLHack|UG-CS Central-Hell's Kitchen
juihung|Sun Feb 17  2002|7:4:57|1149357|HLHack|UG-CS Central-Hell's Kitchen
uenlon|Sun Feb 17  2002|3:31:17|127244|HLHack|UG-CS Central-Hell's Kitchen
uenlon|Sun Feb 17  2002|3:31:19|127244|HLHack|UG-CS Central-Hell's Kitchen
psych|Sun Feb 17  2002|0:35:59|1523882|HLHack|UG-CS Central-Hell's Kitchen


Output:

psych|Sun Feb 17  2002|0:35:59|1523882|HLHack|UG-CS Central-Hell's Kitchen
uenlon|Sun Feb 17  2002|3:31:17|127244|HLHack|UG-CS Central-Hell's Kitchen
uenlon|Sun Feb 17  2002|3:31:19|127244|HLHack|UG-CS Central-Hell's Kitchen
juihung|Sun Feb 17  2002|7:4:56|1149357|HLHack|UG-CS Central-Hell's Kitchen
juihung|Sun Feb 17  2002|7:4:57|1149357|HLHack|UG-CS Central-Hell's Kitchen
S02|Sun Feb 17  2002|7:13:18|831398|HLHack|UG-CS Central-Hell's Kitchen
S02|Sun Feb 17  2002|7:13:20|831398|HLHack|UG-CS Central-Hell's Kitchen

__END__

Wags ;)
-----Original Message-----
From: Yacketta, Ronald [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 18, 2002 08:04
To: Beginners (E-mail)
Subject: sorting an array


Folks,

I have an array which contains data as such

psych|Sun Feb 17  2002|0:35:59|1523882|HLHack|UG-CS Central-Hell's Kitchen
uenlon|Sun Feb 17  2002|3:31:17|127244|HLHack|UG-CS Central-Hell's Kitchen
uenlon|Sun Feb 17  2002|3:31:19|127244|HLHack|UG-CS Central-Hell's Kitchen
juihung|Sun Feb 17  2002|7:4:56|1149357|HLHack|UG-CS Central-Hell's Kitchen
juihung|Sun Feb 17  2002|7:4:57|1149357|HLHack|UG-CS Central-Hell's Kitchen
S02|Sun Feb 17  2002|7:13:18|831398|HLHack|UG-CS Central-Hell's Kitchen
S02|Sun Feb 17  2002|7:13:20|831398|HLHack|UG-CS Central-Hell's Kitchen

and would like to sort it by the second and third field (the date IE "Sun
Feb 17  2002 7:13:20")
I have tried several different methods including the use of Date::Manip
etc..
no matter what I do the date is not sorted in descending order
(http://www.sampier.com/busted.php)

Regards,


Ronald J. Yacketta
Principal Consultant
Ciber, INC
345 Woodcliff Dr.
Fairport, NY 14450
-----------------------------------------------------------------------
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. 

Any review, retransmission, dissemination or other use of, or taking of 
any action in reliance upon, this information by persons or entities other 
than the intended recipient is prohibited. 

If you received this in error, please contact the sender and delete the 
material from any computer.
-- 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to