FWIW, using $a and $b outside of sort is always a mistake
In reply to Re^3: the variable is lost by Anonymous Monk in thread the variable is lost by cruise