On Wed, Aug 31, 2005 at 05:32:25AM -0700, Thilo Girmann wrote: > The statement "$s = $1" causes Perl to re-use the string "abcd" > for storing the first half ("ab") and add a terminating zero. > $2 still points to the original second half but the character > "c" got overwritten neanwhile. > > So if the bug is present you will get " c" or just "c" printed > out instead of the expected "cd".
I've added a TODO regression test for this in t/op/pat.t, but I'm not sure how to fix this, without creating a speed hit by copying the matched string every time. Nicholas Clark