in reply to My best attempt at sorting. Kindly suggest improvements/modifications.

Instead if guessing what a starting value for the biggest and smallest values are,

my $biggest_so_far = 0; my $smallest_so_far = 0;

Use the first value in the array for both :

my $biggest_so_far = my $smallest_so_far = $sortit[0];

This way, you get the exact range.