Thanks Peter!,

PS> That's because you missed out the next line, where the value from
PS> (the equivalent of) @$valref{cn} is dereferenced again with
PS> @$attrVal.

PS> I don't know why the dereferencing is done in the example with 
PS> @$valref{$attrName}; that's needlessly complicated (single element slice
PS> of hash via reference?!).  It'd make more sense to use -> :

PS>     print $valref->{cn}->[0];

PS> (Assuming you have only one cn, as most people do.)

PS> In fact, you can get it right from the search result.
PS> $result->as_struct returns a reference to a hash keyed by DN, with values being
PS> references to hashes keyed by attribute name, whose values are references to
PS> arrays of attribute values.  So:

PS> my $href = $result->as_struct;
PS> for my $dn (keys %$href) {
PS>   print "cn of $dn is $href->{$dn}{cn}[0]\n";
PS> }

That is exactly what I was looking for!

PS> (That's taking advantage of the fact that you can leave out -> between
PS> closing and opening {} or [].)

So my problem was that I was dereferencing the hash, but not the array
reference it was talking About? or was it that I was not using the [0]?

-- 
Tim Musson
Flying with The Bat! eMail v1.62q
Windows 2000 5.0.2195 (Service Pack 2)
The generation of random numbers is too important to be left to chance.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to