Hi All!
I have been given a task of modifying someone else's program. The program i have to modify does not use strict and warnings. So I decided to put them in, and I am having all sorts of error messages. Anyway I fixed most of these errors, but there is a a bit that I just cannot fix and also I don't understand the syntax. Could you help me figure out what the program is trying to do? Here is the code (@ldx array is a multidimensional array and I cannot put it here because it is quite big):
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++;
[$#indexUlt]\n");
print TEST3 ("ct = $ct\n");
}
This is the syntax I don't understand (I now it is doing some kind of sorting but this is where the program is giving error messages):
#@indexUlt=sort{$nxxult[$a]<=>$nxxult[$b]} 0 ... $#nxxult;
Here is the error message:
Use of uninitialized value in numeric comparison (<=>) at C:\SORT.pl l
+ine 791, <AREA> line 22371.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.