my $foo; if( eval { \@$foo } ) { print $foo, $/; } __END__ ARRAY(0x34d10) #### my $foo= "not_a_code_reference"; print "oops!\n" if eval { \&$foo };