>Is there a way to determine the type of a reference at runtime ?

Sure is. Use the 'ref' function.

e.g.

if (ref($pointer) eq "HASH")
{
...
}

See http://www.perldoc.com/perl5.6.1/pod/func/ref.html for more detail.

MK.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Story,
Lenny
Sent: Friday, 29 August 2003 8:46 AM
To: [EMAIL PROTECTED]
Subject: Auto Detect Reference Type ?


Greetings,

Is there a way to determine the type of a reference at runtime ?  If for
example a subroutine returns a Reference to a variable which could be a
Hash, Array  or Scalar. The program should be able to determine how to
access it...

Thanks,
-Lenny
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to