On 2023-02-27 12:20, demerphq wrote: > For those who want a simple example of the bug that this patch fixes > here is a simple example: > > With blead perl this program should print out "foo", but does not. > $ perl -le'my @a=("foo"); sub t {@{$_[0]}=(); print $_[1];} > t(\@a,$a[0]);' > > With Dave's branch it behaves as expected: > $ ./perl -le'my @a=("foo"); sub t {@{$_[0]}=(); print $_[1];} > t(\@a,$a[0]);' > foo > To me that is a confusing example. I don't see (yet) how/why it should print out "foo". Details below. -- Ruud -- -- -- -- -- -- -- -- Why would you want/expect it to print "foo", when you are using aliased parameters, and are deliberately emptying the array? If you really want it to print "foo", just code differently, to have copies where needed? perl -Mv5.28 -wE'my @a=("foo"); sub t {@{$_[0]}=(); say $_[1];} t(\@a, "$a[0]");' foo perl -Mv5.28 -wE'my @a=("foo"); sub t ($p1, $p2) {@$p1=(); say $p2;} t(\@a, $a[0]);' fooThread Previous | Thread Next