in reply to Re: Sort routine runs into infinite loop
in thread Sort routine runs into infinite loop

use strict; helps a whole lot less if you:

my ($i,$j,$tmp);

and actually we are using Perl so you can:

#!/usr/bin/perl use strict; use warnings; my @array = (12, 6, 2, 9, 15); for my $i (0 .. $#array) { for my $j ($i + 1 .. $#array) { @array[$j, $i] = @array[$i, $j] if $array[$j] < $array[$i]; } } print "array : @array \n";

If you'd used warnings you'd have caught the error in the process of fixing the warnings.

Premature optimization is the root of all job security