Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Complex Sort - using varying numbers of parameters

by fruiture (Curate)
on Jul 04, 2002 at 12:42 UTC ( #179445=note: print w/replies, xml ) Need Help??


in reply to Complex Sort - using varying numbers of parameters

@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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://179445]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2021-07-27 11:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?