On Thu, 25 Mar 2004 [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.

yeah, if you have 5.8 you can use mergesort from the sorts module

use strict; use warnings;   # always!
use sort '_mergesort';      # only work with perl 5.8

my $instring = "BB10,BB1100,BB11";

my @temparray = split(",",$instring);
my $outstring = join(",", sort
        { substr($a, 3, 5) cmp substr($b, 3, 5) } @temparray );

print $outstring;

__END__


-- 
Christian Bolstad - [EMAIL PROTECTED], PGP key #E7BCEB9A - http://atdt.nu/
  "I hate quotations."  -- Ralph Waldo Emerson


-- 
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