On Mar 25, 2004, at 4:51 PM, [EMAIL PROTECTED] wrote:

any modules out there that can sort things such as.. BB10, BB1100,BB11. I want it to be in this order. BB10,BB11,BB1100.

I'm not sure about the modules, but it's generally pretty easy to roll your own sort, in Perl. See if this code gets you going:


#!/usr/bin/perl

use strict;
use warnings;

my @codes = qw(BB10 BB1100 BB11);
print "@codes\n";

my @sorted = map { join '', @$_ }
                         sort { $a->[1] <=> $b->[1] }
                         map { m/(\D+)(\d+)/ ? [$1, $2] : ['', $_] } @codes;
print "@sorted\n";

__END__

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to