Randy J. Ray wrote:
eg. How would I code this:
sub foo { my $ref = shift; die unless ($ref is an array pointer); }
die unless ($ref eq 'ARRAY');
The built-in types are SCALAR, ARRAY, HASH, CODE, GLOB and (according to the ref() docs in perlfunc) LVALUE. Also, if the reference is blessed, you get the package name. Check out perlref and "perldoc -f ref".
Whoops - you meant
die unless ( ref $ref eq 'ARRAY' );
Your version would only die if we had done
my $ref = 'ARRAY';
or somesuch ;)
Belden