cbdoc has asked for the wisdom of the Perl Monks concerning the following question:
0 being an integer and F being an alpha character. My code currently looks like:000_FFF0_0000 0011_FFF0_0010 00111_FFF00_00011
This works, but is only sorting on $1 (first \d*). I am unsure how to sort on all 3 regex extractions. Ideally, it would combine the 3 ($1$2$3) and just sort on that value. But can't figure out how to do this. Any help would be greatly appreciated!foreach my $peptide_id (sort { ($a =~ /(\d*)_FFF(\d*)_(\d*)/)[0] <=> ($b =~ /(\d*)_FFF(\d*)_(\d*)/)[0]}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sorting on multiple variables
by ikegami (Patriarch) on Jul 22, 2009 at 23:45 UTC | |
by hobbs (Monk) on Jul 23, 2009 at 09:59 UTC | |
by cbdoc (Novice) on Jul 23, 2009 at 16:51 UTC | |
|
Re: Sorting on multiple variables
by Bloodnok (Vicar) on Jul 23, 2009 at 00:03 UTC | |
|
Re: Sorting on multiple variables
by salva (Canon) on Jul 23, 2009 at 06:35 UTC | |
by cbdoc (Novice) on Jul 23, 2009 at 16:53 UTC | |
|
Re: Sorting on multiple variables
by susanti13 (Novice) on Jul 22, 2009 at 23:53 UTC |