You can use this module, you just need to provide sorting:
tie @a, "Tie::Array::Sorted", sub { $_[0]->[2] <=> $_[1]->[2] };
(Or something like that ... I will need to check this. Basically, you need to sort based on the element of the array that you are passing)
Edit:. Yes, this works for your data. Just checked:
use Tie::Array::Sorted; tie @a, "Tie::Array::Sorted", sub { $_[0]->[2] <=> $_[1]->[2] }; push @a, [ "1111", "http:// ...", 3]; push @a, [ "5555", "http:// ...", 0]; foreach $ref (@a) { print $ref . "\n"; print "@$ref \n"; }
Outputs:
ARRAY(0x9130888) 5555 http:
Brian roach
source share