Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfW +eek, $dayOfYear, $daylightSavings) = localtime(); my $month_number = $month + 1; my %months_name = ( 1 => 'January', 2 => 'February', 3 => 'March', 4 => 'April', 5 => 'May', 6 => 'June', 7 => 'July', 8 => 'August', 9 => 'September', 10 => 'October', 11 => 'November', 12 => 'December', ); print "Current month is: $months_name{$month_number}\n"; my @months = qw(January February March April May June July August Sept +ember October November December); my @three_months = splice @months, -12, $month_number; print "\n @three_months\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Print every past three months from current month
by wazat (Monk) on Apr 01, 2014 at 03:23 UTC | |
by Anonymous Monk on Apr 01, 2014 at 13:00 UTC | |
by wazat (Monk) on Apr 01, 2014 at 16:11 UTC | |
by AnomalousMonk (Archbishop) on Apr 01, 2014 at 18:48 UTC | |
|
Re: Print every past three months from current month
by tangent (Parson) on Apr 01, 2014 at 02:52 UTC |