This solution makes the assumption that if spaces occur, they will always occur at four-digit intervals. The OP didn't say that was the case. While it may be the case, we're not sure.
Your use of tr/// is ineffective, at any rate. It's doing nothing. If evaluated in scalar context it would return the number of spaces found, but if you intended to delete spaces, you need to add the /d modifier. However, that would be contrary to what the OP was asking. In his example output, whitespace is preserved.
| [reply] |