[MacPerl-AnyPerl] Sorting a list of alphanumeric strings

2001-08-24 Thread Adam Witney
Hi, I am trying to sort a list like this exon1 exon5 exon12 exon30 exon2 Into -> exon1 exon2 exon5 exon12 exon30 Any ideas on how to do this? Thanks adam

Re: [MacPerl-AnyPerl] Sorting a list of alphanumeric strings

2001-08-24 Thread David Iberri
This was my first guess, but I'm sure there are better ways: my @ary = qw(exon1 exon5 exon12 exon30 exon2); @ary = sort by_exon_num @ary; print join("\n", @ary), "\n"; sub by_exon_num { $a =~ /(\d+)/; my $a_dig = $1; $

Re: [MacPerl-AnyPerl] Sorting a list of alphanumeric strings

2001-08-24 Thread Jay Bedsole
There's a module on CPAN that does what you want, I think. Sort::Naturally