Perl › 日付・時刻 月末日を取得する関数のサンプルです。Time::Localモジュールのtimelocal関数を使って存在する日付を確かめています。 use strict; use warnings; print "(1)月末日を取得する。\n"; my $end_of_month_200802 = end_of_month(2008, 2); print "2008年2月の月末日は$end_of_month_200802日です。\n"; # 月末日を求める関数。 sub end_of_month { my ($year, $month) = @_; return if !$year || !$month; # Time::Local::timelocal関数は1900からの経過年を引数 # にとるので、1900を引く。 $year -= 1900; # Time::Local::

