@Tree = sort { my $la = @{ $a->{Path} }; #length of left side my $lb = @{ $b->{Path} }; # ~ of right side my $r; # r = return for( 0 .. ($la > $lb ? $lb : $la) ){ $r = $a->{Path}[$_] <=> $b->{Path}[$_] and return $r #return if not 0 } $r #return last comparison } @Tree; # HTH
It should be for( 0 .. ($la>$lb?$lb:$la)-1 ) of course

In reply to Re: Complex Sort - using varying numbers of parameters by fruiture
in thread Complex Sort - using varying numbers of parameters by George_Sherston

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":