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
In reply to Re: Returning single or multiple values?
by ccn
in thread Returning single or multiple values?
by sschneid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |