Change content order using regular expression in perl

It can be done as follows :-

my $date = "2009-27-02";
$date =~ s/(\d{4})-(\d{2})-(\d{2})/$2\/$3\/$1/;
say $date;

O/p

27/02/2009

Leave a Reply