http://www.perlmonks.org?node_id=551797


in reply to Re: Indented HEREDOC?
in thread Indented HEREDOC?

sorry for the nit-pick, but given the OP's example showed a variable, the example really should have been.
if ($foo) { print <<" STRING"; foo is $foo. STRING }
With the difference being that I've used double quotes and not single quotes. I mention it becuase I missed this the first time I saw heredocs, and didn't realise it caused the entire contents of the heredoc to be either interpolated or not, dependant on whether you used double or single quotes, respectively.

The output of the above would obviously be

foo is whatever_is_in_foo

as opposed to single quotes, which would give

foo is $foo
---
my name's not Keith, and I'm not reasonable.