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.
Thanks for letting me think this out on the list.
You should also look at the Scalar::Util module.
--
To uns
> -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
On Fri, 2006-02-06 at 13:25 -0400, Ryan Frantz wrote:
> If I create a reference, can I determine if it's an
> arrayref of hashref?
if( ref( $ref ) eq 'HASH' ){
print "It's a hash\n";
}elsif( ref( $ref ) eq 'ARRAY' ){
print "It's an array\n";
}elsif( ref( $ref ) eq 'SUB' ){
print "It's a sub
> -Original Message-
> From: Ryan Frantz
> Sent: Friday, June 02, 2006 1:25 PM
> To: beginners
> Subject: Determining Reference Type
>
> Perlers,
>
> I've delving into XML for the first time, bear with me...
>
> I've constructed a document t
Perlers,
I've delving into XML for the first time, bear with me...
I've constructed a document type that is modeled after the objects found
in the ADSI namespace for an IIS server and there are cases where some
objects have multiple instances (new to objects too, so I hope I didn't
butcher that t
Andrew Gaffney wrote:
How do you determine what type of data a reference points to? I have a
function (one in previous post) that can take either an array of scalars
or an array of hash references. I want to execute different code based
on which one it was. How can I do that?
perldoc -f ref
WC -Sx- Jones wrote:
Andrew Gaffney wrote:
How do you determine what type of data a reference points to? I have a
function (one in previous post) that can take either an array of
scalars or an array of hash references. I want to execute different
code based on which one it was. How can I do tha
> How do you determine what type of data a reference points to? I have a
function (one in
> previous post) that can take either an array of scalars or an array of
hash references. I
> want to execute different code based on which one it was. How can I do
that?
>
perldoc -f ref
Alternatively
Andrew Gaffney wrote:
How do you determine what type of data a reference points to? I have a
function (one in previous post) that can take either an array of scalars
or an array of hash references. I want to execute different code based
on which one it was. How can I do that?
use the ref() func
On Tue, Apr 06, 2004 at 05:15:17PM -0500, Andrew Gaffney wrote:
> How do you determine what type of data a reference points to? I have a
> function (one in previous post) that can take either an array of scalars or
> an array of hash references. I want to execute different code based on
> which
How do you determine what type of data a reference points to? I have a function (one in
previous post) that can take either an array of scalars or an array of hash references. I
want to execute different code based on which one it was. How can I do that?
--
Andrew Gaffney
Network Administrator
S
11 matches
Mail list logo