David Turley <dturley@illuminet.net> writes: }Can someone please tell me what it is about Math on the Mac that I am missing? Integer bugs in 5.002. It has nothing to do with math; it has everything to do with integer representations in 32 bit words. } }I've written a date comparison script that runs just fine on Perl for Win32 }(which I'm stuck with at work), or when I upload it to my Apache server. } }When I try to run the script on MacPerl I get very strange numbers. The }library routines appear the same so I'm not sure what the problem is. I }found the script below in the O'Reilly's CGI book which is very similar to }the code I am using. It too will run on Win but not the Mac. } }On the Mac this script tells me there are 34193 days until tommorow, or for }that matter ANY day in the future! } }And I was jusy beginning to feel like I understood MacPerl :-( } }#!/usr/local/bin/perl } }require "timelocal.pl"; Don't use timelocal.pl. Use Time::Local. Time::Local has been fixed. timelocal.pl has not. #!/usr/local/bin/perl use Time::Local; $chosen_date = "08/14/97"; if ($chosen_date =~ m|^(\d+)/(\d+)/(\d+)$|) { ($month, $day, $year) = ($1, $2, $3); print "$month $day $year\n"; $month -= 1; if ($year > 1900) { $year -= 1900; } $chosen_secs = timelocal (0,0,0, $day, $month, $year); $seconds_in_day = 60 * 60 * 24; $time = time; $difference = $chosen_secs - $time; print "$difference\n"; $no_days = $difference/ $seconds_in_day; $no_days =~ s/^(\+|-)//; print $no_days; exit(0); } else { print " [Error in date format] "; exit(1); } Of course, if you really want to, you can use Math::BigInt as well. } } }TIA, } }David } }___________________________________________________________ }David Turley }dturley@illuminet.net }Fredericksburg, VA }USA } }"If you want to know what God thinks about money, just } look at the people He gives it to." } -- Old Irish Saying } }___________________________________________________________ --- Paul J. Schinder NASA Goddard Space Flight Center Code 693, Greenbelt, MD 20771 schinder@pjstoaster.pg.md.us ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch