In debugging a regex problem, I gradually whittled a test case down to the following code. It does roughly:
@a = ('aaa', 'ac'); $x = $a[0]; print $x; $x = substr("aaacacaaba", 3, 3); # "cac" $y = $a[0] print $y; and prints out aaa cac So the substr is somehow modifying the first element of the array. I'll dive back into this tonight, but maybe somebody has an idea? It acts as if the '$x = $a[0]' ('set_s_p_kic S0, P0[0]') makes a reference to the array element that gets modified via substr. Am I just confused about how things are supposed to work? (Note that changing the substr to either 'set S0, "cac"' or 'assign S0, "cac"' will make the problem disappear. new_p_ic P0,13 # PerlArray set_p_kic_sc P0[0],"aaa" set_p_kic_sc P0[1],"ac" set_s_p_kic S0,P0[0] print_s S0 print_sc "\n" substr_s_sc_ic_ic S0,"aaacacaaba",3,3 set_s_p_kic S1,P0[0] print_s S1 print_sc "\n" end