the sort routine

sortby () {
  ($name, $date, $time, $wonid, $cheat, $server) = split(/\|/, $a);
   ($wday,$month,$mday,$year) = split(/\s+/, $date);
   ($hour,$min,$secs) = split(/:/, $time);
   $TIME = timelocal($secs,$min,$hour,$mday,$mon,$year);

   ($name2, $date2, $time2, $wonid2, $cheat2, $server2) = split(/\|/, $b);
   ($wday2,$month2,$mday2,$year2) = split(/\s+/, $date2);
   ($hour2,$min2,$secs2) = split(/:/, $time2);
   $TIME2 = timelocal($secs,$min,$hour,$mday2,$mon2,$year2);

   $diff =&Date_Cmp($TIME,$TIME2);
##
##
##
if ( $table_sort eq "adate" ) {
        if ( $diff < 0 ) {
                return $TIME;
        } else {
                return $TIME2;
        }
} elsif ( $table_sort eq "ddate" ) {
        if ( $diff > 0 ) {
                return $TIME <=> $TIME2;
        } else {
                return $TIME2 <=> $TIME;
        }
}
....
....
....
}


sort the array
foreach $line (sort sortby @cheaters) 


-Ron


> -----Original Message-----
> From: Frank [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 18, 2002 12:43
> To: Yacketta, Ronald
> Subject: Re: sorting an array
> 
> 
> On Mon, Feb 18, 2002 at 12:30:11PM -0500, Yacketta, wrote:
> > I am currently doign a split to get the date and time
> > then a timelocal to get epoch. after that is what goes south.
> > everything I try no matter how I do it it is always sorted 
> as I shown :(
> ---end quoted text---
> 
> Ok, my advice post the code and the data in one well written mail ;)
> 
> -- 
>  Frank Booth - Consultant
> Parasol Solutions Limited.
> (www.parasolsolutions.com)
> 

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

Reply via email to