in reply to Re^2: Concatenation appends to front of variable
in thread Concatenation appends to front of variable

s/\s+$//; will get rid of trailing LF, CR or CRLF (and any trailing space and tabs) safely.