seaver has asked for the wisdom of the Perl Monks concerning the following question:
my problem lies in the fact that the interpreter seems to ignore the second section, which is are substr of the values use in the first section:
The $refs are simply letters in uppercase followed by numbers, id like to sort them by their letters, and then by the numbers. Here is a sample (but wrong) output:foreach my $ref ( sort { $a cmp $b || substr($a,1) <=> substr($b,1) } keys %{$self->{'residues'}{$i}}){ print "$ref\t"; }
If I dont include the '$a cmp $b', then the keys are sorted according to the numbers, so I know that the substr section is working, but it just doesn't seem to pass through the '||'...A95 A96 A97 A98 A99 B1 B10 B11 B12 B13
cheers
Sam
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sorting using substrs of same string
by seaver (Pilgrim) on Sep 23, 2003 at 20:25 UTC | |
by dragonchild (Archbishop) on Sep 23, 2003 at 21:10 UTC |