That won't work if the dates are more than a year apart(i.e. 100302 will
appear to be greater than 011503).  I would recommend looking into the
Time::Local module.  You can use it to convert the text dates into Perl
time() format.  Then you can easily do a numeric conversion.

-----Original Message-----
From: Mark G [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 27, 2003 2:04 PM
To: [EMAIL PROTECTED]
Cc: perl
Subject: Re: Comparing Dates Conditional statements


> How can I have condition as such
> 
> $date = 'XX/XX/XX'; <-insert any date
> If $date is greater then 01/01/02 then do .....
> Else ....
> 

here is one simple way:

<~~~cut

$foo="01/01/02";
$bar="01/03/02";

$foo =~ s/\///g;
$bar =~ s/\///g;


if( $foo > $bar ){

 print "\$foo is greater then \$bar \n";

}
elsif( $foo == $bar){

 print "\$foo is equal to \$bar \n"; 

}
else {
 
 print "\$bar is greater then \$foo \n";

}

<~~paste
----- Original Message ----- 
From: "Paul Kraus" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 27, 2003 3:43 PM
Subject: Comparing Dates Conditional statements


> How can I have condition as such
> 
> $date = 'XX/XX/XX'; <-insert any date
> If $date is greater then 01/01/02 then do .....
> Else ....
> 
> 
> Paul
> 
> 
> -- 
> 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]

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

Reply via email to