
Laurent_R
Veteran
/ Moderator
Jun 7, 2016, 1:21 AM
Post #2 of 3
(8397 views)
|
Re: [zatlas1] Sort::Tree question
[In reply to]
|
Can't Post
|
|
Well, we would need to know more about your tree to be able to suggest a solution and test it. Maybe you could try this:
sub alpha { my ($a, $b, $f) = @_; lc($a->{$f}) cmp lc($b->{$f}); } Or try to use the "alphabetically" subroutine provided by the module:
foreach my $row (Sort::Tree::tree_to_list(\@tree, ['id'], [\&Sort::Tree::alphabetically], 'class')) { print ' ' x $row->{class}, $row->{name}, "\n"; }
|