No, I think your use of a string is the right thing to do in this example. Having the open near the same as you would use for a file is good, especially to demonstrate the three parameter open. I'd tend to use a normal string rather than a string ref just to make it clear magic is happening though.
I probably went one step too far putting the HEREDOC in the open though, but I was so chuffed to see it worked like that that I couldn't help it. :-D
I don't think there was ever an issue of trailing white space in the OP's question and I don't see how the "data remains on the screen" comment applies. However, minor points and nothing to really worry about. More to do with style differences than right or wrong ways to do things. In Perl I almost never use the concatenation operator because Perl offers so many other ways to get the job done that appeal more to my eye, and for multiple line stuff my go to tool is the HEREDOC because in code it most looks as it's going to look as output.
Premature optimization is the root of all job security