in reply to Perversity of sorts

Without an explicit return, a subroutine returns the final statement evaluated, which in your case is
@_
If you defined do_nothing as:
sub do_nothing {}
Then you'd get a different result, namely there'd be nothing in @out
Update: Sorry, didnt test this. You will actually get the error:

Sort subroutine didn't return a numeric value at nothing.pl line X

if you define do_nothing() as i described. But the reasoning still stands.

Replies are listed 'Best First'.
Re^2: Perversity of sorts
by tlm (Prior) on Apr 01, 2005 at 00:28 UTC

    I realize that; the puzzle (for me at least) is that sort does not sort the returned contents of @_. (Actually, this puzzle is "explained" by -MO=Deparse's output; now it is the perversity of this output that needs explaining.)

    Something tells me that I'm missing something whoppingly obvious...

    the lowliest monk