A bit of code.
sub is_hash_ref {ref($_[0]) =~ /HASH/}
sub is_array_ref {ref($_[0]) =~ /ARRAY/}
sub is_scalar_ref {ref($_[0]) =~ /SCALAR/}
Roll your own for other types of references.
-----Original Message-----
From: Story, Lenny [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 28, 2003 3:46 PM
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