Open philiprbrenan opened 4 weeks ago
This looks like the inconsistency described in https://github.com/Perl/perl5/issues/17883 (preceded with more historical detail in https://github.com/Perl/perl5/issues/14436).
The current state of affairs is that some (de)referencing is needed to accomplish this:
push @{$t ? \@t1 : \@t2}, 'AAAA';
I'm unclear on whether resolving the inconsistency could result in the above also being prohibited, c.f. https://github.com/Perl/perl5/issues/14436#issuecomment-646996371
By the way the reason the first version works is because a constant expression is replaced at parse time so it only sees the @s1
operand.
In the line marked OK the choice of which array to use is controlled by a constant and all works as expected. But replacing the constant by a variable produces an unexpected message: Experimental push on scalar is now forbidden.