#!/usr/bin/perl -w use HTML::Template; use strict; my $html = HTML::Template->new( utf8 => 1, filename => 'example.07.template', ); # today's date my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year += 1900; # 1900-based $mon += 1; # 0-based $html->param(today => "$mon/$mday/$year"); # days of the week my @days = ({day => 'Monday'}, {day => 'Tuesday'}, {day => 'Wednesday'}, {day => 'Thursday'}, {day => 'Friday'}); $html->param(days => \@days); # random true/false $html->param(yesNo => rand(1) > 0.5); print "Content-Type: text/html; charset=utf-8\n"; print "\n"; # separator before content # HTTP content print($html->output());