There are (at least) two ways to access sort routines in a different package:

Prototype the sort subfunction and pass the values as arguments, which can then be accessed by directly indexing @_

Fully qualifying $a and $b in the sort routine with the package name of the caller (this works because prior to Perl 6 the elements to be compared are passed to the sort routine in the package global variables $a and $b)