http://qs1969.pair.com?node_id=11141078

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks!

Getting a warning on a line of code where I am trying to use "sprintf" to pad the month date with a leading 0.
Use of uninitialized value $_ in pattern match (m//) at...
#!/usr/bin/env perl use strict; use warnings; my $date = "3-15-1932" $date=~ s/(\d+)-(\d+)-(\d+)/$3-\/sprintf("%02d",$1)\/-$2/ge; print $date; #Want to print like this: 1932-03-15

Is it how I could use spritnf with in the regex?

Thanks for looking!