in reply to Re: How to compare time in perl
in thread How to compare time in perl

The equal width and 0 packing of single digits is vital as this will choke cmp:

2003/02/05 2:32:06.179 2003/02/05 17:32:06.179 2003/02/05 20:32:06.159
cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Replies are listed 'Best First'.
Re: Re: Re: How to compare time in perl
by demerphq (Chancellor) on Feb 08, 2003 at 23:19 UTC
    Even if they aren't to begin with he can normalize them first:
    $time=~s{ #$1 $2 $3 $4 $5 $6 $7 (\d+)/(\d+)/(\d+)\s+(\d+):(\d+):(\d+)\.(\d+) } { sprintf '%04d/%02d/%02d %02d:%02d:%02d.%3d', $1, $2, $3, $4, $5, $6, $7 }xe or die "Failed to normalize '$time'\n";

    --- demerphq
    my friends call me, usually because I'm late....