I'm not really sure what you mean. If you still need the header, you should be unshifting it onto $array_ref_b, just like you were doing in your original code. That's assuming that what you really want in the end is something along the lines of [ $header, $array_ref, $array_ref_b ].