Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

comment on

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.

In reply to Re^2: Indented HEREDOC? by reasonablekeith
in thread Indented HEREDOC? by Withigo

and:  <code> code here </code>

  • Please read these before you post! —
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (5)
    As of 2019-09-17 00:13 GMT
    Find Nodes?
      Voting Booth?

      Results (199 votes). Check out past polls.