Sorting the same array twice and assigning the results to two new arrays, potentially very long, is a bit wasteful when all you want is to find the smallest and largest value in the array. You could for instance do something like this:
my($largest, $smallest) = (sort { $b <=> $a } @array)[0,-1];