use warnings; use strict; use Template; use CGI qw( header ); print header(); my $tt2 = Template->new( TRIM => 1 ); my @actions = qw( foo bar ); my @titles = ( "O HAI", "O NOES", "KTHXBAI" ); $tt2->process(\*DATA, { title => $titles[rand@titles], my_action => $actions[rand @actions], }) or warn $tt2->error; __DATA__ [%~BLOCK foo %] This is my foo. There are many foos like it but this one is mine. [%~END %] [%~BLOCK bar %] This is my barbaz. This is my qux. This is for coding, this is for... uh... [%~END %] [%~# TEMPLATE ----------%]