Use cmp for comparing strings and <=> for comparing numbers (see perlop). What you want is something like this:
@{$self->{queue}} = sort{ $a->id <=> $b->id || $a->name cmp $b->name } @{$self->{queue}};
In reply to Re: Sort on two properties
by kyle
in thread Sort on two properties
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |