Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
what's wrong with this code :
actually two questions :
1) why don't the $a,$b values of the SORT routine
print ?
2) what is wrong with the sort routine?
it doesn't sort; (rearrange the list)
package netFetObj; sub fetSort { print " ######### A = $a \n"; print " ######### B = $b \n"; my $ftA = $a->{"fet"}; my $ftB = $b->{"fet"}; $fetType->{$ftA} <=> $fetType->{$ftB} }
where fetType is updated
whenever the appropriate object method is invoked
package something_else; foreach my $fetOBJ ( sort { &netFetObj::fetSort } @{ $OBJ->{"fets" +} } ) { buildFet($FH,$fetOBJ,$OPT); }
and the LIST to sort is a list of netFetObjs.
Edited by planetscape - removed pre tags, added code tags and rudimentary formatting
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sorting objects
by rhesa (Vicar) on Jun 23, 2006 at 01:16 UTC | |
by Anonymous Monk on Jun 23, 2006 at 01:33 UTC | |
|
Re: sorting objects
by ikegami (Patriarch) on Jun 23, 2006 at 01:16 UTC |