Not the same thing.  gsub'ing works even when you interpolate "\n" in the heredoc (causing the following line to start at column 0).