I just want to convert the dates from 20111230 format to 30-dec-2011.
20111230
30-dec-2011
A quick solution.
my $date = '20111230'; my @months = ( 'Jan','Feb','Mar','Apr', 'May','Jun','Jul','Aug','Sep', 'Oct','Nov','Dec' ); if($date =~ m/^(\d{4})(\d{2})(\d{2})$/){ print $3 . '-' . $months[$2-1] . '-' . $1; }