use strict; use warnings; use Astro::MoonPhase; use Math::Trig; # you will need the cosine function # print cos X ; # where X in radians; my $date = time(); my @dataphase = phase($date); print "Distance to the Moon at this day: ", $dataphase[3], " Km";