require Template; sub send_phonelist_ldif { my $cgi = CGI->new; my $template = Template->new({ INCLUDE_PATH => '/path/to/template/dir', TAG_STYLE => 'asp', }); print $cgi->header(-type => 'text/plain'); my $data = { people => get_phonelist_data() }; $template->process('phonelist.ldif', $data); # goes to STDOUT }