in reply to HOW Can I pass the array into my subroutine?

You can also use prototypes (if you omit the "&" when you call it), like so:
sub sortArray(\@) { # Array is in @{$_[0]} } ... sortArray @arr;
This just implicitly "enreferences" the first argument.