* help with perl
@ 1997-10-24 6:07 jain
0 siblings, 0 replies; 2+ messages in thread
From: jain @ 1997-10-24 6:07 UTC (permalink / raw)
To: tru64-unix-managers
hi there,
I am trying to use the date function in perl and the value of
the month seems to be wrong. Can anyone help me.
I am running perl 5.0 patch 2 verison on alpha 3.2c. of dunix.
---------perl code I used-------
#!/usr/local/bin/perl
#
local ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $isdst)
= localtime();
$ad_update = "$month/$day/$year";
print "Ad Last updated = $ad_update \n";
print "all the values = sec, min, hour, day, month, wday, yday, isdst \n";
print "all the values = $sec, $min, $hour, $day, $month, $wday, $yday, $isdst \n";
exit(0);
----------------------------
output I get:
Ad Last updated = 9/24/97
all the values = sec, min, hour, day, month, wday, yday, isdst
all the values = 4, 3, 1, 24, 9, 5, 296, 1
Ad when I use system date from prompt I get:
% date
Fri Oct 24 01:06:12 CDT 1997
so somewhere there is a problem.
Thanks for all your help.
rakesh
^ permalink raw reply [flat|nested] 2+ messages in thread
* help with perl.
@ 1998-01-20 18:59 jain
0 siblings, 0 replies; 2+ messages in thread
From: jain @ 1998-01-20 18:59 UTC (permalink / raw)
To: tru64-unix-managers
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1998-01-20 18:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-01-20 18:59 help with perl jain
-- strict thread matches above, loose matches on Subject: below --
1997-10-24 6:07 jain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox