[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Omaha.pm] here doc help
On Fri, 10 Jul 2009, Chad Homan wrote:
Greets all
So I have a interesting issue that I need some assistance with.
I found a here doc "formatting" function on-line (at CPAN) that claims to
"expect input from a here doc".
I've made one little change to preserve "blank lines" (i.e, changed a couple
"\s" to "[\t ]"), hence the
function name.
Now I want to offload it into a require file. however "perl -c" fails when
doing so.
It worked for me when I changed file3.pl to:
$cde_script = dequote_blank_lines(<<_EOF_
#!/bin/sh
#real code removed for brevity
/usr/bin/echo "Hello World"
_EOF_
);
print $cde_script;
Note the parens, lack of ; after the heredoc initiator.
In general, it's considered best practice to always use parens with
non-core functions, so this is the Right Thing to do anyway. I think
the parser was probably just getting confused with some ambiguity
there, although I'm not Perl wonk enough to know what the ambiguity
might have been.
Chris St. Pierre
Unix Systems Administrator
Nebraska Wesleyan University