Well, to go along with the other example(s), here is a way of doing it using
the localtime() function:

use strict;
use warnings;

my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek,
$dayOfYear, $daylightSavings) = localtime();

my $monthnum = $month + 1;

my %monthname = (
                  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("The present month is: $monthname{$monthnum}\n");

Regards,

Jeff

Reply via email to