in reply to sort an array with +ve & -ve numbers in it

You can also get the minimum value by using the

$#sorted

This will hold the last element's index in the array