Matt Fowles wrote:
All~
What does the reduce metaoperator do with an empty list?
my @a; [+] @a; # 0? exception? [*] @a; # 1? exception? [<] @a; # false? [||] @a; # false? [&&] @a; # true?
Also if it magically supplies some correct like the above, how does it
know what that value is?
My general thoughts has been that:
[op] @list
behaves something like:
eval join(op, @list)
so feeding it an empty list would return undef, regardless of op. Similarly, if @list is just one element, it returns that element.
-- Rod Adams