CPAN モジュールの DateTime::Format::Strptime は DateTime と同じ Dave Rolsky さんが開発しているもので、日付時刻を含む文字列のパースによく使われているのではないかと思います。 このモジュールの挙動が v1.58 から変わっていました。 #!perl use feature qw(say); use DateTime::Format::Strptime; my $strp = DateTime::Format::Strptime->new( pattern => '%Y%m%d', ); for my $str (qw/20160330 access_log.20160330/) { my $dt = $strp->parse_datetime($str); say "$str => undef " and next unless $dt
![DateTime::Format::Strptime にパッチを送った話 #Perl - weblog of key_amb](https://cdn-ak-scissors.b.st-hatena.com/image/square/e074c5ea623c99654f066ee8c588e4f75078d8e3/height=288;version=1;width=512/http%3A%2F%2Fcdn-ak.f.st-hatena.com%2Fimages%2Ffotolife%2Fk%2Fkey_amb%2F20160401%2F20160401074307.png)