Dear Monks,
I've been sitting here for an hour trying to figure out this debugging problem. So, in a last ditch effort I'm hoping someone can pick out what's going on here. Here is the relevant snippet (this is a PDL routine):
my ($matrix, $limits) = @_; # I get my data and limits from the argum
+ents of subroutine
my $j = 1;
my ($pdl1, $pdl2, $n1, $n2);
my ($angle, $dotproduct, $d, %angles);
$pdl1 = pdl (@{$matrix}[0]);
$n1 = norm $pdl1;
while ($j<=$#{$matrix}) {
$pdl2 = pdl (@{$matrix}[$j]);
$n2 = norm $pdl2;
$dotproduct = inner ($n1, $n2);
$d = $dotproduct->sclr();
$angle = (180/3.14159)*acos($d);
$angles{$j} = $angle;
$j++;
}
my @sorted = sort {$angles{$a} <=> $angles{$b}} keys %angles;
And at this point I can't sort! It tells me that it returns an un-numeric value. But I SWEAR that my values are all numeric: if I push all $angle values into an array directly, I can sort them. Can anyone help me figure what's going on here?
20030516 Edit by Corion - Changed empty CODE blocks to BR tags
Title by tye