use HTML::Template; use Captcha::reCAPTCHA; my $c = Captcha::reCAPTCHA->new; my $t = HTML::Template->new( scalarref => \$template_file ); $t->param( => "print $c->get_html( 'your public key here' );" ); $Output = $t->output;