This seems to be the result of a Net::LDAP search. I would suggest you
better read the perldoc for the module , there are methods to directly
give you the cn, sn etc from the entry. 

That way even if you upgrade the module and if the structure of the
object changes you wont have to change any of your code. Anyway If you
*really* want to use messy calls to the object directly you could do
this. 

To make it look less confusing you could just remove one level of a
reference like 

my %hash = @{$a};
now access the elements at will 

$sn = $hash{sn}    # If you are sure there can only be one sn 

if(ref($hash{cn}) eq 'ARRAY') { 
   @listof_cn = @{$hash{cn}};
} else { 
  $cn = $hash{cn};
}


HTH
Ram

On Mon, 2004-08-09 at 06:19, Luis Daniel Lucio Quiroz wrote:
> Hi,
> 
> $a = [
>         'cn'   => ['Barbara Jensen', 'Barbs Jensen'],
>         'sn'   => 'Jensen',
>         'mail' => '[EMAIL PROTECTED]',
>         'objectclass' => ['top', 'person',
>                         'organizationalPerson',
>                                            'inetOrgPerson' ],
>                        ];
> 
> 
> I have this arrary structure, how should I read it?  For example how do I 
> acces to "inetOrgPerson' value or Jesen value?
> 
> Thanks
> 
> LD



-- 
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