use strict; use warnings; my @f = ( localtime )[0..5]; my $system_date = sprintf "%d" . "%02d" x 5, $f[5] + 1900, $f[4] + 1, @f[ 3, 2, 1, 0 ]; print $system_date, "\n";