my $string = 'DD-MM-YYYY HH:MM::SS'; $string = sprintf '%s-%s-%s %s', split /[- ]/, $string; # $string ist jetzt 'YYYY-MM-DD HH:MM::SS';