Gotcha. So "best practice" would be to qualify the names in a function meant to be (re)used as a sort, and wish Perl generated a warning if a sort was called from a different package. Could do that myself, if a "debug mode" was enabled (a custom "use warning" setting, perhaps). Jumping through hoops to make the function work with the caller's package defeats the point of having $a,$b in the first place. So, create a fully-reusable (member of a class, whatnot) compare function that takes 2 args in the normal way; if someone wants to use it in a sort they call it from their local sort block:
. If you don't write functions meant to be directly used as a sort, the problem doesn't crop up.