As
Anonymous Monk has
pointed out you may want to consider a different module.
You might also consider a different approach when using HTML::Template.
my $fruit_field = q{banana};
my $food_field = q{banana};
my $param = (
is_a_banana => $fruit_field eq q{banana}?1:0,
fruit_and_food => $fruit_field eq $food_field?1:0,
);
<TMPL_IF is_a_banana>
I'm a banana
</TMPL_IF>
<TMPL_IF fruit_and_food>
eat fruit
</TMPL_IF>
Put the code (your expression) in the script and leave the template to look after the HTML. While I prefer this approach there are many monks who would argue in favour of, say,
Template::Toolkit.
It's up to you which approach best suits your task.