in reply to If Condition in Template file
...using text Template.
In case you mean Text::Template, you could do something like this:
use Text::Template; my $tmpl = <<'EOTMPL'; {$Col1 ? "Col1:$Col1" : ''} {$Col2 ? "Col2:$Col2" : ''} {$Col3 ? "Col3:$Col3" : ''} EOTMPL my $template = Text::Template->new( TYPE => 'STRING', SOURCE => $tmpl ); $Col1 = 12; $Col2 = 4; $Col3 = 0; my $text = $template->fill_in(); print $text; __END__ Col1:12 Col2:4
|
|---|