曜日名の短縮した英語名をPerlモジュールのTime::Pieceで生成
PerlモジュールのTime::Pieceを使用して、現在の日時から曜日名の短縮した英語名を出力しました。)
#!/opt/local/bin/perl
use strict;
use warnings;
use utf8;
use Time::Piece;
use Time::Seconds qw(ONE_DAY);
print "Content-type: text/plan charset=utf-8\n\n";
my $time = Time::Piece::localtime();
for(1..7) {
print +($time->wdayname),"\n";
$time += Time::Seconds::ONE_DAY;
}
exit;
Fri
Sat
Sun
Mon
Tue
Wed
Thu
サンプルコードと出力結果です。現在の日時から順に、曜日名の短縮した英語名を出力しました。