On Jun 15, 2004, at 2:24 PM, Angie Ahl wrote:

Hi

Howdy.

Scouring the books to try and find this, but it's evading me.

How can I test whether something is an array.

For some definition of "something" that includes references, use ref(). :)


ie I have a hash and some values are anon arrays and some are strings. I want to test to see whether one is an array and then traverse it.

if ( ref($some_hash{might_be_array_ref}) eq 'ARRAY' ) { # ... }

Hope that helps.

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to