my $dfile = 'd1528235.txt'; open my $dfh, '<', $dfile; my $date; while ( <$dfh> ) { chomp; if ( not $date and $date = join '/', /=\((\d\d)(\d\d)(\d\d)/ ) { my $str1 = '$date'; my $date1; $date1 = Time::Piece->strptime($date, '%D, %M, %dhd, %Y') ; my $date2 = $date1->strftime("%A %b %d, %Y"); $worksheet->merge_range('A2:G2',$date2,$format5,);