Blob


1 #!/usr/bin/perl
3 use v5.24;
4 use warnings;
5 use strict;
6 use utf8;
7 use local::lib;
8 use lib qw(/home/jrmu/documents/perl/Time-Moment-0.44/lib/);
9 use Time::Moment;
11 # Write a program using Time::Moment to compute the interval
12 # between now and a date that you enter as the year and month on
13 # the command line:
14 #
15 # $ perl duration.pl 1960 9
16 # 50 years, 8 months, and 20 days
18 my $now = Time::Moment->now;
19 my $then = Time::Moment->new(
20 year => $ARGV[0],
21 month => $ARGV[1],
22 );
23 $now->delta_years($dt);
24 $now->delta_months($dt)%12;
26 print "$years years and $months months\n";