http://www.perlmonks.org?node_id=504898


in reply to Re^2: need regular expression
in thread need regular expression

I prefer to use strings - in that case, it becomes easy to deal with 3 or 4 digit years as well:
my @dates = qw /4-10-31 14-11-31 1979-10-10/; for (@dates) { s/(\d+)/substr("2000", 0, -length($1)).$1/e; print "$_\n"; } __END__ 2004-10-31 2014-11-31 1979-10-10
Perl --((8:>*