$aref = []; $href = {}; $sref = \""; my $text = 'some text'; my $ref = \$text; my $blessed = bless($ref, 'ARRAY'); print prt_typ($_) for ( [ $aref, '$aref'], [ $href, '$href'], [ $sref, '$sref'], [$blessed, '$blessed'], ); sub prt_typ { my ( $rin, $str ) = @{$_[0]}; print "ref($str) = ", ref($rin), "\n"; eval { my $x = ${$rin} }; return "$str is SCALAR\n\n" unless $@; eval { my %x = %{$rin} }; return "$str is HASH\n\n" unless $@; eval { my @x = @{$rin} }; return "$str is ARRAY\n\n" unless $@; } #### ref($aref) = ARRAY $aref is ARRAY ref($href) = HASH $href is HASH ref($sref) = SCALAR $sref is SCALAR ref($blessed) = ARRAY $blessed is SCALAR