in reply to Re: Testing for definition of references
in thread Testing for definition of references

Thanks, but I actually am trying to avoid using ref() if possible. Also, you are testing:
if(defined $arrayref)
This is insufficient since $arrayref may be set to a scalar value and thus would return true. I don't want to test to see if $arrayref is simply defined, but if the array it references is defined. I use:
if(defined @$arrayref)
as a means to distinguish the definition of an array reference from all other types of data. My question relates to whether this is valid test or not.

Replies are listed 'Best First'.
Re: Re: Re: Testing for definition of references
by Anonymous Monk on Jun 26, 2003 at 18:15 UTC
    Why are you avoiding ref()?
Re: Re: Re: Testing for definition of references
by fglock (Vicar) on Jun 26, 2003 at 18:18 UTC

    No, it's not. An empty array will return false!