Closed p5pRT closed 20 years ago
use Time::Local;
sub calculateage{ # # calculate the age of the patch according to current date # $DAY = 24 * 60 * 60; %MONTHS = ( "Jan"\, 0\, "Feb"\, 1\, "Mar"\, 2\, "Apr"\, 3\, "May"\, 4\, "Jun"\, 5\, "Jul"\, 6\, "Aug"\, 7\, "Sep"\, 8\, "Oct"\, 9\, "Nov"\, 10\, "Dec"\, 11 ); ( $lmonth\, $day\, $year ) = split(/\//\, $_[0]); $month = $MONTHS{$lmonth}; $start = timelocal( 1\, 1\, 1\, $day\, $month\, $year ); $end = time; print "testing:start=$start\,end=$end\,day=$day\,month=$month\,yr=$year\n"; $age = int( ( $end - $start ) / $DAY ); }
##============================================== ## BEGIN ##============================================== #
@home = ("couch"\, "chair"); #foreach $i (@home) { &calculateage("May/04/99"); # } #============================================== # END #==============================================
__END__
#!/bin/sh
LD_AOUT_PRELOAD=libperl.a ./perl -I. -Ilib utils/perlcc -o t1 -L . t1.pl && ./t1
Migrated from rt.perl.org#926 (status was 'resolved')
Searchable as RT926$