in reply to $a and strict

$a and $b are special in that they are automagically defined in the main:: scope due to their use in the sort function. In other words, with regards to strictness, they're considered in the same class as @_, $_, etc.


Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain

Replies are listed 'Best First'.
Re (tilly) 2: $a and strict
by tilly (Archbishop) on Jul 18, 2001 at 18:13 UTC
    Not true.

    Unlike *_, *ENV, etc, $a and $b are in the current package. They are just, like @INC, only exempt from strict.

    Beware! Should you wish to write a sort subroutine that will be called from another package, you must go out of your way to use $a and $b from *their* package, and not your own. (Similarly if they try to pass a sort subroutine into your function, it won't work as expected.)

    UPDATE
    Thanks tye for spotting my obvious thinko.