in reply to Sort and related stuff
Lots of good answers here already. Short form, $a and $b are only used once in the first example, which is why you're being warned. In the second example, sort is using them as well. No warning.
For the record, I would strongly recommend not building a subroutine that relies on external data that may or may not exist correctly. In this case, if I do two sorts and then do a call to this sub with variables set by the first sort, your subroutine will use the $a and $b vars from the second sort rather than the arguments I sent the function.
|