Jeff Pang wrote:
use strict; use warnings;my @arr = qw(14-special.4-32 14-special.4-32 14-special.4-33 14-special.4-33 15-special.1-51 15-special.1-51 15-special.1-52 15-special.1-52 15-special.1-52 15-special.1-53 15-special.1-53 15-special.1-53 15-special.1-54 15-special.1-54 15-special.3-44 15-special.3-44 15-special.3-45 15-special.3-45 15-special.4-4 15-special.4-4 15.2-100 15.2-100 15.2-104 15.2-104 15.2-124 15.2-124 15.2-65 15.2-65 15.2-66 15.2-66); my @new = map { $_->[0] } sort { $b->[1] <=> $a->[1] } map { [$_,(split/-/)[-1]] } @arr; print "@new[0..4]";
Fails; this would put '15-special.3-45' before '15-special.1-51' As I said, separate the data into fields, based on your knowledge of how to do it. (Nobody on this list knows how.) Then you can sort. -- Just my 0.00000002 million dollars worth, Shawn "For the things we have to learn before we can do them, we learn by doing them." Aristotle -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
