in reply to Re^3: problem with Mail::Sender while sending email
in thread problem with Mail::Sender while sending email

Look at this:
$var = 'hello world'; print <<'END'; $var END
and this
$var = 'hello world'; print <<"END" $var END
Assuming you really do want a 'heredoc' here, you want the second kind.

Don't put stars in the heredoc terminator, that's ugly. If it doesn't stand out enough already, you need a different editor. END



- Boldra

Replies are listed 'Best First'.
Re^5: problem with Mail::Sender while sending email
by Jenda (Abbot) on Aug 28, 2009 at 19:21 UTC

    Beauty is in the eye of the beer holder! I use the "*END*" all the time. Not just that it stands out more, but it's also less likely to appear in the stuff I'm quoting. And my editor does highlight the heredocs just fine, thank you.

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.

      I was convinced I could counter with a rewrite of Chandanperl's code with a typo or two and get it to compile and produce something totally unexpected ( using an empty binary shift <<, a glob *END and the glob of $OFS, *, thrown up against the $var in the example), but I haven't managed it yet.

      This was the basis of my argument about the 'ugliness' of the terminator - if it looks enough like a completely different piece of valid perl, and you have to think for a moment to work out how it will be parsed, I call it ugly. Since I can't support my argument with a concrete example, I'll have to let you off - this time! :)

      Personally, I usually use a long string as a terminator, since I only have to type it twice.



      - Boldra
        I most frequently use __XML__ __HTML__ __YAML__ or __RAW__