Randal L. Schwartz wrote:
Robin> I have a similar problem. My function has this return statement:
Robin> my %hash=( one => 1, two => 2 );
Robin> return wantarray ? %hash : \%hash;
Robin> But when I try to access a member in the hash it fails.
Right. For this, keep in mind that TT calls this function (if
I understand correctly) *always* in a list context, so you'll
get the key/value pairs. Ugh.
If you always want a "TT Hash", you'll have to always return \%hash
even in a list context.
Bottom line is, "wantarray" is dangerous... Unfortunately it's kind of
late to change my code now, but I learned the lesson. ;-)
Cheers,
-M.
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates