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, %b, %Y') ; $worksheet->merge_range('A2:G2',$date1,$format7,);