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
In reply to sorting objects by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |