punitpawar has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; my @array=(12,6,2,9,15); my ($i,$j,$tmp); for ($i=0;$i<@array;$i++){ for ($j=0;$j<@array;$j++){ if ($array[$j]>$array[$j+1]){ $tmp=$array[$j+1]; $array[$j+1]=$array[$j]; $array[$j]=$tmp; } } } print "array : @array \n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Sort routine runs into infinite loop
by choroba (Cardinal) on Jan 02, 2016 at 17:23 UTC | |
Re: Sort routine runs into infinite loop
by pme (Monsignor) on Jan 02, 2016 at 17:35 UTC | |
by GrandFather (Saint) on Jan 02, 2016 at 21:34 UTC | |
by hotchiwawa (Scribe) on Jan 02, 2016 at 17:50 UTC | |
by oiskuu (Hermit) on Jan 02, 2016 at 18:47 UTC | |
by Laurent_R (Canon) on Jan 02, 2016 at 19:51 UTC | |
by hotchiwawa (Scribe) on Jan 02, 2016 at 19:56 UTC |