in reply to Returning single or multiple values?
At first you do not check for existence of a second element of an array, but check it's truth.
You can rewrite it like this:
foreach my $entry ($result->all_entries()) { foreach ( $entry->attributes() ) { my $ra = [ $entry->get_value($_) ]; $r->{$entry->dn()}->{$_} = @$ra > 1 ? $ra : $ra->[0]; } }
Update: lexical $r renamed to $ra
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Returning single or multiple values?
by sschneid (Deacon) on Aug 27, 2004 at 19:33 UTC |