return { my %row = %{$self->[1]} };
Note that this copies the hash to %row and then copies that into an anonymous hash. This second copy is of no use. Either avoid the copy into %row or just return a reference to it:
And there are other ways to do it, of course. Several ways that don't work:return +{ %{$self->[1]} }; #or return do { my %row = %{$self->[1]}; \%row }; #or my %row = %{$self->[1]}; return \%row;
and several others that don't work either. (: - tyereturn { %{$self->[1]} }; # {} interpretted as a block return \my %row = %{$self->[1]}; # \ binds tighter than =, so same as: # (\my %row) = %{$self->[1]}; return \( my %row = %{$self->[1]} ); # flattens hash and returns ref to each item
In reply to Re: Tie::STHRows for HTML::Template loops (extra copy)
by tye
in thread Tie::STHRows for HTML::Template loops
by antirice
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |