> [EMAIL PROTECTED] - Sat Jun 19 11:06:22 2004]: > > perl -wle 'sub foo { return 1..5} print sort foo(8)' > 8 > > while a bit annoying (I wanted to sort the result of foo applied to > 8), > this is actually what is documented as the > sort SUBNAME LIST > form of sort. foo is the subname and there is one value to be sorted: > 8 > > 5.6.1 this will reportedly behaves the same (I don't have a 5.6.1 > anymore)
5.6.2 does. > More interesting: > perl -wle 'sub foo { return 1..5} print sort(foo(8))' > 12345 > > I see nothing in the sort docs that would make me expect a change in > behaviour here by just adding parenthesis. > (Nor does it in real indirect object cases like print(STDERR "foo")) I don't think print is the right analogy here. map and grep have the closest interface to sort. > So you get an extra warning and it behaves the same as without the > parenthesis. For both things I think that the 5.6.1 behaviour was the > right one. In fact, I'd also have expected the unquoted string warning > for the case without parenthesis, but it seems 5.6.1 doesn't do that. > > If you don't agree with me that these are bugs, this behaviour should > at > least be documented. I don't know if its a bug so much as an ambiguity made espcially tricky by its reliance on whitespace to DWIM. Changing the behavior to this would seem to be more like folks would expect. sort foo(8) # call foo(8) and hand the results to sort sort foo (8) # use foo() as the sort routine to sort the list (8). And before the C<func (arg)> style camp objects, its not working properly for that style now anyway.