This is a good explanation in helping me determine what I needed to use. It turns out that all I need is to store the entire output as a string without worrying about lines, or even formatting conventions.
Thank you to everyone who contributed. I especially enjoyed reading about the differences between the backticking and open() with pipes. I know I will use both in the future.