use strict; use warnings; my( @dates ) = ( '4-10-31', '14-11-31' ); foreach my $date ( @dates ) { my $string = $date; $string =~ s/^(\d+)/ my $year=2000; substr($year,4-length($1),length($1))=$1; $year/e; print $string, "\n"; }