in reply to Not able to ParseDate lines from a file

According to your updated code and the associated message,

substr $array[13], 22, 8

returns undef while

substr $array[13], 32, 4

returns 1. I don't believe that is possible. I believe the information you gave us is (still) incorrect.

By the way, I'd use:

use DateTime::Format::Strptime qw( ); my $format = DateTime::Format::Strptime->new( pattern => '%d.%m.%Y %H:%M:%S', time_zone => 'Asia/Calcutta', on_error => 'croak', ); my $dt = $Strp->parse_datetime($array[13]);