> -----Original Message----- > From: Ryan Frantz > Sent: Friday, June 02, 2006 1:48 PM > To: beginners > Subject: RE: Determining Reference Type > > > > > -----Original Message----- > > From: Ryan Frantz > > Sent: Friday, June 02, 2006 1:25 PM > > To: beginners > > Subject: Determining Reference Type > >
--snip-- > > I _could_ wrap some checks in eval blocks as such: > > print "\n\$defaultDocument is "; > eval { ( @$defaultDocument ) }; > if ( $@ ) { > print "_not_ an array reference!\n\n"; > eval { ( %$defaultDocument ) }; > unless ( $@ ) { > print "But it _is_ a hash reference...\n\n"; > } > } else { > print "an array reference!\n\n"; > } > > But that raises two questions: > > 1. Is this a good/preferred/robust method for performing the check? > 2. How do I get rid of that pesky 'Useless use of a variable in void > context...' error? > <sheepish> I, ahem, did some more digging and found that the great Perl gods have already thunk this one through and provided the ref() operator. It returns the reference type just as I need. </sheepish> Thanks for letting me think this out on the list. ry -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>