Mattwatters
Technical User
Hello
I am trying to split lines do the odd calculation and put the results into an array. basically an array of arrays. After this is done i am trying to sort this array on the 6th field of the arrays it holds. After this i am trying to print out the array to a html table but somewhere along the line somethings gone wrong cause my table is empty apart from the odd "15" in some columns - possibly to do with the number of array items. Could someone please let me know if there are any fundamenal flaws or if i am passing things properly. I know the data going into the code below is valid
$increment=0;
if($comp2 eq $comp1)
{
$line1 = $table1a{$comp2};
$line2 = $table2a{$comp2};
$line3= $table3a{$comp2} @fields1=split(/\s+/,$line1); @fields2=split(/\s+/,$line2);
@fields3=split(/\s+/,$line3);
$inorder[0]=$fields1[0]; $inorder[1]=$($fields1[1]); $inorder[2]=$fields1[3]+$fields2[3]+$fields3[3]/3; $inorder[3]=$fields1[4]+$fields2[4]+$fields3[4]/3; $inorder[4]=$fields1[5]+$fields2[5]+$fields3[5]/3; $inorder[5]=$inorder[2]+$inorder[3]+$inorder[4]/3;
$inorder[6]=$fields1[3];
$inorder[7]=$fields2[3];
$inorder[8]=$fields3[3];
$inorder[9]=$fields1[4];
$inorder[10]=$fields2[4];
$inorder[11]=$fields3[4];
$inorder[12]=$fields1[5];
$inorder[13]=$fields2[5];
$inorder[14]=$fields3[5];
$sorted[$increment] = @inorder;
$increment++;
}
@sorted1 =( sort { $a->[5] <=> $b->[5] } @sorted);
for $val1(@sorted1)
{
@sorted3=$val1;
Rest of Print code here - use @sorted3 to print
}
cheers
I am trying to split lines do the odd calculation and put the results into an array. basically an array of arrays. After this is done i am trying to sort this array on the 6th field of the arrays it holds. After this i am trying to print out the array to a html table but somewhere along the line somethings gone wrong cause my table is empty apart from the odd "15" in some columns - possibly to do with the number of array items. Could someone please let me know if there are any fundamenal flaws or if i am passing things properly. I know the data going into the code below is valid
$increment=0;
if($comp2 eq $comp1)
{
$line1 = $table1a{$comp2};
$line2 = $table2a{$comp2};
$line3= $table3a{$comp2} @fields1=split(/\s+/,$line1); @fields2=split(/\s+/,$line2);
@fields3=split(/\s+/,$line3);
$inorder[0]=$fields1[0]; $inorder[1]=$($fields1[1]); $inorder[2]=$fields1[3]+$fields2[3]+$fields3[3]/3; $inorder[3]=$fields1[4]+$fields2[4]+$fields3[4]/3; $inorder[4]=$fields1[5]+$fields2[5]+$fields3[5]/3; $inorder[5]=$inorder[2]+$inorder[3]+$inorder[4]/3;
$inorder[6]=$fields1[3];
$inorder[7]=$fields2[3];
$inorder[8]=$fields3[3];
$inorder[9]=$fields1[4];
$inorder[10]=$fields2[4];
$inorder[11]=$fields3[4];
$inorder[12]=$fields1[5];
$inorder[13]=$fields2[5];
$inorder[14]=$fields3[5];
$sorted[$increment] = @inorder;
$increment++;
}
@sorted1 =( sort { $a->[5] <=> $b->[5] } @sorted);
for $val1(@sorted1)
{
@sorted3=$val1;
Rest of Print code here - use @sorted3 to print
}
cheers