The problem is that you are confusing a reference to an array
with the array itself. Your $data variable is a scalar (not an array)
whose value is a reference to an array. You need to use indirection
to get at the elements of the array. These are all equivalent: