in reply to check array reference empty

Although your message says "defined" you need to use the defined function to test whether a scalar is defined.

To determine if a scalar contains a reference to an array use the ref function: ref( $arr_ref1 ) eq 'ARRAY'.

To determine if $arr_ref1->[0] exists then test the size of the array @$arr_ref1 >= 1