Nope. You're using an array slice @x[$y] where you really
want an element $x[$y]. And as pointed out elsewhere, you're using
cmp where you want <=>.
-- Randal L. Schwartz, Perl hacker | [reply] [d/l] [select] |
| [reply] |
if array#num is really a number, <=> might be a better
option ...
@array = sort { $$a[2] <=> $$b[2] } @array;
--
Greg McCarroll
http://www.mccarroll.uklinux.net
| [reply] [d/l] |
Thanks for the tip. I used this to sort my array[][][]. I was able to sort my list by an object property as follows:
@memory_blocks = sort {hex(${$b}[0][0]->address) <=> hex(${$a}[0][0]->
+address)} @memory_blocks;
Hope that might help someone else who gets stuck. Thanks again! | [reply] [d/l] [select] |