help with perl.

From: Rakesh Jain <jain_at_mail.physics.smu.edu>
Date: Tue, 20 Jan 1998 12:59:54 -0600 (CST)

hi there,

        I am trying to do a date match in perl and it does not seem to work.
here is my test program and output.

-------------------------------------
#!/usr/local/gnu/bin/perl

$month = 0;

local ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $isdst)
        = localtime();

++$month;

if ($month <= 9) {
        $month = "0$month";
                }

if ($day <= 9) {
        $day = "0$day";
                }

$d_ad_updated = "121297";
$s_ad_updated = "$month$day$year";
print "s_ad_updated = $s_ad_updated\n";

if ($s_ad_updated < $d_ad_updated)
{
        print "$s_ad_updated is less than $d_ad_updated\n";
}

system ("date");
exit(0);
------------------------------------------------------------

and output is:

s_ad_updated = 012098
012098 is less than 121297
Tue Jan 20 12:56:42 CST 1998


Here we can see the comparison does not work. Any pointers to solve
this problem will be greatly appreciated.

Thanks
Rakesh
Received on Tue Jan 20 1998 - 20:00:15 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:37 NZDT