use POSIX 'strftime'; my $today = strftime '%d/%m/%Y %H:%M', localtime; $today =~ s!(\d{2})/(\d{2})/(\d{4})!$3-$2-$1!;