in reply to Re: Assist in understanding of old code
in thread Assist in understanding old code

Sorry it should not have been commented out, so the code is:
my $ct=0; my @nxxult = (); my @Ultmnsort = (); my @indexUlt = (); for(my $rn=4;$rn<=32;$rn +=4) { for(my $bn=1;$bn<=$row[0];$bn++) { $nxxult[$bn]=$ldx[$bn][$rn]; } @indexUlt=sort{$nxxult[$a]<=>$nxxult[$b]} 0 ... $#nxxult; $Ultmnsort[$ct]=$indexUlt[0]; $Ultmxsort[$ct]=$indexUlt[$#indexUlt]; $ct++; }
I don't really know what is going on in this code, I am working on it.

Replies are listed 'Best First'.
Re^3: Assist in understanding of old code
by Mugatu (Monk) on Feb 28, 2005 at 23:49 UTC

    Well then, if the line shouldn't actually be commented out, then the problem is as talexb described, "one of the values in the array that's being sorted is undefined." You have two ways of solving that problem:

    • Use an empty string value instead of undef
    • Turn off the warning

    Which solution you pick will usually depend highly on the application. I tend to structure my apps in a way that an empty string makes more sense than undef, but perhaps this one isn't. In that case, turning off the warning (using a lexically scoped no warnings) would be the best option.