Aside: using variable names like $(one letter) can make life difficult for you (later) or future maintainers. The stock suggestion, "use meaningful variable names," is a cliche for good reason!
...and specifically re $a and $b -- those are conventionally used ONLY by and for sort. See the examples in perldoc -f sort.