> 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 if the reference can hold an object you may want the 'isa'
method of:
perldoc UNIVERSAL
my $ref ...
if (UNIVERSAL::isa($ref, 'Gaff::Obj')) {
# handle Gaff objects
}
elsif (ref($ref) eq 'HASH') {
# handle hash ref
}
elsif (ref($ref) eq 'ARRAY') {
# handle array ref
}
etc.
http://danconia.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>