in reply to Bizarre copy of ARRAY

I can't reproduce the error you are seeing, but if you use strictures (use strict; use warnings; ) I'd expect @{@headers} to generate:

Can't use string ("n") as an ARRAY ref while "strict refs" in use at . +..

where n is the number of elements in @headers. Quite likely this is related to your problem. What were you wanting to achieve with @{@headers}?

True laziness is hard work