Hello
I'm trying to sort an array of dates with milliseconds
In the DataTime.pm file, the subroutine compare has the following statements

foreach my $i ( 0..2 )
    {
        return $dt1_components[$i] <=> $dt2_components[$i]
            if $dt1_components[$i] != $dt2_components[$i]
    }

so, my datas have:
dt1_components[0]=733773
dt1_components[0]=55196
dt1_components[0]=631723
and
dt2_components[0]=733773
dt2_components[0]=55196
dt2_components[0]=631776

So, due to those statements, the comparison ends with dt1_components[0]=dt1_components[1] and the compare subroutine says to me that the 2 datas are the same, but it's not true, since they differs in milliseconds

The problem is that if statement on the 2nd line of code is not on the same line of the return line, there is a return on them.
So the return statement is soon executed on the element $i=0
I fixed it putting the if statement on the same line of the return statement and now it works.

If some of you confirm this problem I could open a ticket.

Thanks

Francesco



Reply via email to