in reply to Re^3: Build Sort dynamically
in thread Build Sort dynamically

Ooo, neat! I tried my little test without the extraneous comma and it worked as advertised.

I had thought the discussion regarding prototyping the subroutines supplied to sort applied only to named subroutines. This insight may come in very handy! Thanks for the tip. I will have to re-read the sort docs more closely (but tomorrow -- signing off soon).

(Likewise, the discussion of prototyping in perlsub needs another perusal -- or is it perl-rusal?)

Replies are listed 'Best First'.
Re^5: Build Sort dynamically
by tilly (Archbishop) on Aug 24, 2008 at 07:47 UTC
    What you need to know about prototyping in general is don't. Except when it does something really useful for you.

    The useful places are as follows. If you need to emulate a built-in, you have no choice but to prototype. If you want a constant to be optimized at compile time, you should use a prototype. (But constant does that for you.) The ($$) prototype is useful in sorting. And an & prototype can turn blocks into subroutines saving the need to type "sub ".

    Personally the only prototype that I have found useful in the last 2 years is putting ($$) on a sort routine.