my %variables = ( title => 'lookie here', sections=> [ {label=>'DMA',uri=>'dma'} # - - - 8< - - - SNIP - - - >8 - - - ,{label=>'FOMC',uri=>'dma/FOMC'} ] ); # pretty template for our navigation: # note the UNLESS in for the adding of pipes after all but the last link my $template = q{ [% title %]: [% FOREACH link = sections %] [% link.label %] [% '|' UNLESS loop.last %] [% END %] }; use Template; my $t = Template->new({POST_CHOMP=>1}); $t->process(\$template, \%variables) || die $t->error();