Even if it's easy to check if the next op in the caller is a dereference, a function that returns any of 1) a reference to the array, 2) the contents of the array, or 3) the number of elements in the array is way too magical.
Instead of
@{ $o->Ts } my $ref = \@{ $o->Ts }; my @array = $o->Ts; my $count = $o->Ts;
You'll get fewer headaches with
@{ $o->Ts } my $ref = $o->Ts; my @array = @{ $o->Ts }; my $count = @{ $o->Ts };
p.s. Hey, what's with P.M. not recognizing ">" in code and xlating it to ">"? Doesn't HTML convert text entities everywhere?
Cause it saves you a lot of work.
In reply to Re: How to determine if 'ref' is wanted? (ala 'wantarray')
by ikegami
in thread How to determine if 'ref' is wanted? (ala 'wantarray')
by perl-diddler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |