steer has asked for the wisdom of the Perl Monks concerning the following question:
in case you are wondering, $set->{"cards"} contains an array of cards objects that each have a value method, that returns the value of the card. So far so good. You'll notice the print statement calls the value() method for each card, just before the sort block does the same thing. So:sub sort_by_value { my $set = shift; print "start\n"; print join(',',map {$_->value} @{$set->{"cards"}}); print "end\n"; @{$set->{"cards"}} = sort {$a->value <=> $b->value} @{$set->{"cards" +}}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Vanishing bug
by Aristotle (Chancellor) on Jan 24, 2005 at 22:19 UTC | |
|
Re: Vanishing bug
by Tanktalus (Canon) on Jan 24, 2005 at 20:46 UTC | |
|
Re: Vanishing bug
by hv (Prior) on Jan 25, 2005 at 13:39 UTC |