$input .= $temp;
Your description of "some kind of concatination[sic] error" requires that I cite MJD response #11906: Look at the error message! Look at the error message!
Caution: Contents may have been coded under pressure.
Comment on Re: What is the right way of concatenating strings