There are a few ways to print out formatted dates in Perl, for example strftime in https://metacpan.org/pod/Time::Piece.  Would save on a few lines of code.