sub bbl_sort { my $array = shift; my $not_complete = 1; my $index; my $len = ((scalar @$array) - 2); while ($not_complete) { $not_complete = 0; foreach $index (0 .. $len) { if (@$array[$index] > @$array[$index + 1]) { my $temp = @$array[$index + 1]; @$array[$index + 1] = @$array[$index]; @$array[$index] = $temp; $not_complete = 1; } } } }