in reply to Re: sorting according to greek alphabet in roman letters
in thread sorting according to greek alphabet in roman letters
OK, where do $a and $b come from, are they implicit within 'foo' or are they from 'sort' itself.
I ask because I have a slight OO problem, $a and $b in my case are actually unique reference numbers to atoms in: $self->{'atoms'}.
The function I do the sort in is in the same object and has '$self' defined, but if the 'foo' function resides in the same object, how do I pass $self, or else access the object's hash in order to access the atom objects themselves...
In other words, in foo, I really need to do this:
Any pointers?sub foo { return $self->{'atoms'}{$a}->atomName cmp $self->{'atoms'}{$b}->ato +mName; } my @sorted = sort foo @unsorted;
|
|---|