my @path; if ($foo) { push @path, '/foo'; } else { push @path, '/bar'; } push @path, '/standard_templates'; my $template = HTML::Template->new( filename => 'file.tmpl', path => \@path; );