$ cat -n ex1.pl
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use Template;
5
6 $| = 1;
7 print "Content-type: text/html\n\n";
8
9 my $file = 'greeting.html';
10 my $vars = {
11 message => "Hello World\n"
12 };
13
14 my $template = Template->new();
15
16 $template->process($file, $vars)
17 || die "Template process failed: ", $template->error(), "\n";
$ cat greeting.html <html> <body> <h2>[% message %]</h2> </body>
lhp@nereida:~/public_html/cgi-bin/tt$ ex1.pl Content-type: text/html <html> <body> <h2>Hello World </h2> </body>
Casiano Rodríguez León
