in reply to Possible bug with array pointer

What did you expect s/^_//g to do if not remove the underscore?

I believe the answer is that the loop values are aliased so that things exactly like what you wrote will DWIM