There is no need to trim ... this

if $/20

gives a hint that there are more characters to come ... and since the " " is only added if there are more chars. There is never that "trailing space" that needs to be trimmed.