in reply to Debugging a sort in PDL routine

The lines

006 $pdl1 = pdl (@{$matrix}[0]); ... 009 $pdl2 = pdl (@{$matrix}[$j]);
are likely to be incorrect. Check the syntax.

If $matrix is a 2-d array reference, you probably want to dereference that as $matrix->[0]. PDL likes array references just fine for initializing piddles.

After Compline,
Zaxo