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;
In reply to Re: Older people should know their age on Mercury
by thunders
in thread Older people should know their age on Mercury
by thunders
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |