in reply to Re: Scalar ref acting as simulatenous hash and array?
in thread Scalar ref acting as simulatenous hash and array?
Both array assignment and hash assignment cause the RHS to be evaluated in list context. wantarray can't tell the difference between array and hash assignment.
my @arr = get_it(); my %hash = get_it(); sub get_it { if (defined wantarray) { print wantarray ? 'list' : 'scalar'; } else { print 'void'; } print " context\n"; return; }
This prints "list context" twice.
--"The first rule of Perl club is you don't talk about Perl club."
|
|---|