in reply to Debugging a sort in PDL routine

It all looks pretty sane to me with seeing the data. I would suggest the you include a print statement in the sort block and see what you are getting.

my @sorted = sort { print "$a|$b|$angles{$a}|$angles{$b}\n"; $angles{$a} <=> $angles{$b} } keys %angles;
That should show what it doesn't like, then all that's left to do it track down where it's coming from:)
Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller

Replies are listed 'Best First'.
Re: Re: Maybe I'm just dumb...
by Evanovich (Scribe) on May 16, 2003 at 04:23 UTC
    I just did what you said, and keys '33' and '32' print with their values. But their values are just random numbers in my hash. My question now is, can anyone see anything in my calculations that would have screwed up the values? Does PDL return values that can't be sorted?