note
Zaxo
<p>You don't need a slice if you're sorting the array reference members of @sortarr by a particular set of elements. Assuming numeric values, hence <tt><=></tt> comparisons,
<code>
@sortarr = sort { $a->[3] <=> $b->[3] } @sortarr;
</code>
If you want to sort on several columns, test in your desired order with logical-or between,
<code>
@sortarr = sort {
$a->[6] <=> $b->[6]
||
$a->[7] <=> $b->[7]
||
$a->[8] <=> $b->[8]
||
$a->[9] <=> $b->[9]
||
$a->[10] <=> $b->[10]
||
$a->[11] <=> $b->[11];
} @sortarr;
</code>
Most of that is rarely executed because of the short circuit property of logical or. Looking up values by index is cheaper than copying out a 2-d slice sorting it and correlating the result to the original.</p>
<p>If you do ever need slicing and other ops on deep arrays, see the great [cpan://PDL] module.</p>
<div class="pmsig"><div class="pmsig-82147">
<p>After Compline,<br/>Zaxo</p>
</div></div>
496023
496023