Subject: | Bug (doc or implementation) with reduce() return values |
The doc for reduce() says:
Returns the result of the last call to BLOCK.
It should either be explicitly documented to only return a single value
or should be implemented to handle multiple return values
my ($foo, $bar, $baz) = reduce {$hash{$arr[$a]} < $hash{$arr[$b]}
? ($a, $hash{$arr[$a]}, $arr[$a])
: ($b, $hash{$arr[$b]}, $arr[$b])
} grep defined($arr[$_]), 0 .. $#arr;