Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question: ⭐ (references)
Is there a way to determine whether a variable ($x) is a reference, and if so, what type of thing it refers to?
For example, I want to do something like:
if ( is_not_a_reference($x) ) { print $x; } elsif ( is_a_hash_ref($x) ) { process_hash( %$x ); } else { . . . }
Originally posted as a Categorized Question.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How do I determine the type of a reference?⭐
by hippo (Bishop) on May 24, 2017 at 14:43 UTC | |
Re: How do I determine the type of a reference?⭐
by choocroot (Friar) on Jun 19, 2002 at 13:33 UTC | |
Re: How do I determine the type of a reference?⭐
by tye (Sage) on Sep 18, 2003 at 17:03 UTC | |
Re: How do I determine the type of a reference?⭐
by Mr. Muskrat (Canon) on Sep 18, 2003 at 16:39 UTC | |
by asarih (Hermit) on Sep 18, 2003 at 17:42 UTC | |
by Mr. Muskrat (Canon) on Sep 18, 2003 at 17:57 UTC | |
Re: How do I determine the type of a reference?
by particle (Vicar) on Jun 19, 2002 at 13:26 UTC |
Back to
Seekers of Perl Wisdom