Why are you needless calling get_value twice? It doesn't come for free! Moreover, why are you calling map that way? Personally, I don't like using map throwing away its result; if I need a cycle I prefer using an explicit foreach, for example.
Anyway, my 2c:
foreach my $entry ($result->all_entries()) {
foreach my $attr ($entry->attributes()) {
my @a = $entry->get_value($attr);
$r->{$entry->dn()}->{$_} = @a > 1? \@a : $a[0] ;
}
}
Ciao!
--bronto
The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
--John M. Dlugosz