Re: Can I use a function ref to call a function in a web script?



On Oct 3, 2:12 am, RedGrittyBrick <RedGrittyBr...@xxxxxxxxxxxxxxxxx>
wrote:
C.DeRykus wrote:
...

Not much easier on the eyes but
you could pare down to a single
print with a stacked heredoc:

print <<FORM, func(), <<FORM;
foo bar
FORM
bat boom
FORM

my $optionlist=func(); print <<FORM
foo bar
$optionlist
bat boom
FORM

Is there anything inherently wrong with this?


Yes, that's better if there are multiple interpolations of the
same variable and then you don't
need to stack heredoc's at all.

But there was some doubt:

BenM> If the repeated HTML really
BenM> is the same every time you
BenM> can simply assign it to a
BenM> variable and interpolate
BenM> that ... otherwise, the only
BenM> way to interpolate random
BenM> expressions.

If random though, a stacked heredoc
with a single print is simpler
than the OP's code IMO. The suggested HTML::Template may be best in
the long run.

--
Charles DeRykus

.