How do I sort that to print in price order? I tried something like this:foreach my $obj (@ArrayofObjects){ $obj->print }
but does not work...What am I missing? Cheers...foreach my $obj (sort @ArObj[$a]->price <=> @ArObj[$b]->price} @ArObj) + { # stuff here ... }
In reply to how to sort an array of (Moose) objects by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |