in reply to What type are you? Mr Hash, Sir Array, or Miss Scalar?
The Scalar::Util module has a function 'reftype':
reftype EXPR
If EXPR evaluates to a reference the type of the variable referenced is returned. Otherwise "undef" is returned.
$type = reftype "string"; # undef $type = reftype \$var; # SCALAR $type = reftype []; # ARRAY $obj = bless {}, "Foo"; $type = reftype $obj; # HASH
Hugo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: What type are you? Mr Hash, Sir Array, or Miss Scalar?
by Fletch (Bishop) on May 12, 2004 at 14:31 UTC | |
|
Re: Re: What type are you? Mr Hash, Sir Array, or Miss Scalar?
by Doraemon (Beadle) on May 12, 2004 at 14:48 UTC | |
by Happy-the-monk (Canon) on May 12, 2004 at 15:21 UTC | |
|
Re: Re: What type are you? Mr Hash, Sir Array, or Miss Scalar?
by Doraemon (Beadle) on May 12, 2004 at 15:42 UTC |