It seems as if the split didn't return anything useful to the two variables $initial_datetime and $backlog.
That would explain, why there are uninitialized values in the lines 20 and 22: The script tries to print uninitialized variables.
So I guess, too, that there is a line without a comma, so that your split doesn't work.
Comment on Re: stripping whitespace gives an 'unitialized value' error