0

I am a beginner at Perl, I need to use functions from the Perl module Date::Easter in order to create a program that will take a year from user input and display the date of Easter within that year, i need to know how you would incorporate that module into the script in order to get the desired outcome.

user218001
  • 35
  • 1
  • 8

1 Answers1

2

Simple enough:

#!/usr/bin/perl

use strict;
use warnings;
use Date::Easter;

chomp (my $year = <STDIN>);
my ($m1, $d1) = easter ($year);
my ($m2, $d2) = julian_easter ($year);
my ($m3, $d3) = orthodox_easter ($year);

print "Gregorian => Month: $m1 Day: $d1\n";
print "Julian    => Month: $m2 Day: $d2\n";
print "Orthodox  => Month: $m3 Day: $d3\n";
squiguy
  • 32,370
  • 6
  • 56
  • 63
  • That was really helpful. That is according to the Gregorian, how would you do Julian and orthodox? – user218001 Apr 03 '13 at 23:41
  • @user218001 Browse around here: https://metacpan.org/module/Date::Easter. It is pretty much the same method, just a different name. – squiguy Apr 03 '13 at 23:57
  • but how would you put all 3 in the same script, so its prints 3 dates, one for Gregorian, one for Julian, and one for orthodox. – user218001 Apr 04 '13 at 00:16
  • I need one more solution, i have been searching for a way to change the months from printing as numbers to actual spelled months, do i have to import some other module or is there a simpler way of achieving that. – user218001 Apr 04 '13 at 00:53
  • @user218001 Looks like you asked that elsewhere! – squiguy Apr 04 '13 at 02:19