Sch*_*ern 14
注意:不使用任何模块.
日历很难.不,日历真的很难!这很容易出错.使用模块.
幸运的是,有一个内置的模块,Time :: Piece.它strptime的日期解析为一个对象.从那里你可以问它很多东西.
use v5.10;
use strict;
use warnings;
use Time::Piece;
my $time = Time::Piece->strptime("02-02-2016", "%d-%m-%Y");
say $time->fullday;
Run Code Online (Sandbox Code Playgroud)