but i get following error, Content-type: text/html Can't use string ("hsh2") as a HASH ref while "strict refs" in use at /usr/cisco/packages/perl/perl-5.8.6/lib/site_perl/5.8.6/sun4-solaris/Template/Service.pm line 79. i also tried to pass the reference as $template->process($file,\%add) || die $template->error(); but nothing is substituted in the html file.can u help me how to pass my hash to the html file or i need to change the above code.please help me in this regard. Thanks, srins.as $template->process($file,%add) || die $template->error(); for my hash my %add=( hsh1=>{ name=>"name1 ", type =>"text", default=>" ", value=>[" "], entries=>"M" }, hsh2=>{ name=>"name2 ", type=>"dropdown", req=>"prc", default=>" ", value=>["value1","value2","value3"], entries=>" " } ); for your code [% FOREACH element = add.keys %] [% IF add.$element.type == "text" %] <input type="text" name="[% add.$element.name %]" value="[% add.$e +lement.default %]"> [% ELSIF add.$element.type == "dropdown" %] <select name="[% add.$element.name %]"> [% FOREACH option = add.$element.value %] <option value="[% option %]"> [% option %] </option> [% END %] </select> [% END %] <br> [% # put a line break between the form elements %] [% END %]
In reply to Re^2: how to define html::template for the following hash in perl/cgi
by srins
in thread how to define html::template for the following hash in perl/cgi
by srins
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |