in reply to Older people should know their age on Mercury
It's a shorter program and it would even work for Dracula, now.#!/usr/bin/perl -w #mercury.pl-how old am I in Mercury Years. use Time::localtime qw(localtime);#also for ctime use POSIX; #for floor use Date::Calc qw(Delta_Days); #length of Mercury year in earth days $mercuryRevolution = 87.97; #get birthday stats for Oct 1, 1977 $birthDay = 1;$birthMonth=9;$birthYear=1977; $daysAlive = Delta_Days($birthYear,$birthMonth,$birthDay, localtime->year()+1900,localtime->mon(), localtime->mday()); $mercuryYears = POSIX::floor($daysAlive / $mercuryRevolution); $nextMercuryBday = $daysAlive % $mercuryRevolution; $nextBirthDate = ctime(time()+ ($nextMercuryBday *24*60*60)); #strip hours,minutes,seconds from ctime string $nextBirthDate =~ s/(\w+\s\w+\s\d+)(\s\S+\s)(\w*)/$1,$3/; print "\nYou are ".$mercuryYears." Mercurian Years old", "\nYour next Mercurian Birthday is in " . $nextMercuryBday . " days\n", "on ". $nextBirthDate;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Older people should know their age on Mercury
by ehdonhon (Curate) on Oct 03, 2001 at 05:40 UTC | |
by Sweeper (Pilgrim) on Oct 03, 2001 at 09:41 UTC | |
by thunders (Priest) on Oct 03, 2001 at 08:00 UTC |