The below program is to rearrange a string. For line 8, I am trying to store the results of a regex into a new variable $newdate, but when $newdate is printed in line 9, it only displays a 1. How can I change my code so that $newdate will store the $date value from the regex operation?
1 #!/usr/bin/perl
2
3 # This program changes the date format from mm/dd/yyyy to yyyy,mm,dd
4
5 $date = '21/11/2011';
6 print "Current: $date\n";
7
8 $newdate = $date =~ s/(..)\/(..)\/(....)/$3,$2,$1/;
9 print "New: $newdate\n";