This is all perl internals, perlguts stuff. The CV you get in $code has an ->OUTSIDE C pointer to the PADLIST that @arr lives in and then the compiled code has a note on which index in that PADLIST it is suppposed to access the @arr at. So it isn't a copy. The code in $code works with the real, original @arr, not a copy.