####
#!/usr/bin/perl
use strict;
use warnings;
use CGI qw(:standard);
use HTML::Template;
my $cgi = new CGI;
my $tmpl = new HTML::Template(
path => [ '/path/to/' ],
filename => menu_bar.tmpl,
);
$tmpl->param(
[
{
option_name => 'Home',
optopn_address => '/index.cgi',
},
{
option_name => 'About',
option_address => '/about.cgi',
},
{
option_name => 'Contact',
option_address => '/contact.cgi',
},
]
);
print $cgi->header();
print $tmpl->output();
####
{
option_name => "$option",
option_address => "$address",
}
####
my @options = ("Home", "About", "Contact",);
my %options_menu = (
Home => '/index.cgi',
About => '/about.cgi',
Contact => 'contact.cgi',
);
$tmpl->param(
menu_options => [
foreach(@options){
{
option_name => "$_",
option_link => "$menu_options{$_}",
},
}
],
);