Hi Philip,
Thank you very much for help. Your explaination is very clear. Since I am used to
program in C++, I am quite confused about the usage of perl's variables and objects,
especially their declaration and convention. Would you give me some advice, please?
Also, I heard that using HTML::Template we could define a variable and a counter in
the template. Could you tell me how to use such features, please? I am using
HTML::Template version 2.5 . Thanks a lot.
Yours,
cwt
> Sometime Today, Sam Tregar assembled some asciibets to say:
>
> > use HTML::Template;
> > my $htmltemplate = HTML::Template->new("template.htm");
> > my %myHash;
>
> don't declare the hash here.
>
> > my @myRecord = [];
>
> This should either be:
>
> my @myRecord = ();
>
> OR:
>
> my $myRecord = [];
>
> read man perldata for the difference.
>
> > for(int $i=0; $i<3; $i++)
> > {
>
> declare the hash here:
>
> my %myHash;
>
> > foreach my $obj($htmltemplate->query(loop=>"record"))
> > {
> > $myHash{$obj} = "Tom".$i;
> > }
> > push (@myRecord, %myHash);
>
> you cannot store hashes in arrays. man perldata for why.
>
> push @myRecord, \%myHash;
>
> > }
> > $htmltemplate->param(record=>@myRecord);
>
> again, only use a scalar, so:
>
> ->param(record=>\@myRecord);
>
>
> Philip
>
> PS: I had written a more elaborate mail, but it got lost accidentally,
> so this one's probably a little short. You can search the archives for
> the above, it's been asked before.
>
>
> --
> Counting in octal is just like counting in decimal--if you don't use
> your thumbs.
> -- Tom Lehrer
>
>
>
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users