> Hi,
> 
> Richard Heintze wrote:
> 
> >I have an array of hashes. What function should I be
> >using to interrogate each array cell when I want to
> >know if it is occupied?
> >
> >  "exists" seemed to do the job nicely. What about
> >"defined"?
> >
> exists only works with hashes. Please check the recent conversation
about "Array containment", where Rob Dixon advised me to turn my array
into a hash to use the exists function.
> 

Caveat version... depends on the version of Perl.  Newer 'exists' can
check arrays... from perldoc -f exists:

"Given an expression that specifies a hash element or array element,
returns true if the specified element in the hash or array has ever been
initialized...."

Works at least as of 5.6.1.

As to your other question, check out:

perldoc -f ref

You may also find, 

perldoc UNIVERSAL

particularly 'isa' helpful...

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>


Reply via email to