use strict; use warnings; my $scalar_ref=*foo{SCALAR}; print "scalar ref defined\n" if defined $scalar_ref; #------------------------# my %hash=(); my hash_ref=*hash{HASH}; print "hash ref defined\n" if defined hash_ref; __END__ output Name "main::foo" used only once: possible typo at ref.pl Name "main::hash" used only once: possible typo at ref.pl scalar defined