in reply to DBI fetchrow_array problems

erm, have you tried using an "order by" clause in your MySQL query? eg:
my $sth21= $dbh->prepare(qq{SELECT MR_M FROM MR2 ORDER BY MR_M});
When you do a select from MySQL with no order by, it just returns records in the same order as they were inserted.

However, even with the order by clause, you may still not get the expected result. Your columns are presumably "char" or "text" types, but from the description of your problem you really want them ordered numerically. If you're familiar with your data, there is a trick you can use with MySQL to achieve this. Basically, you order the data based on a subset of the field in question. So you could do something like:

SELECT MR_M FROM MR2 ORDER BY RIGHT(MR_M,LENGTH(MR_M)-1);
This would drop the first character of the string (the "M") and sort on the remaining characters - the numerics.

Alternatively, you could sort the array/s as you print it/them. Although, you'd still face the same challenges with numeric vs lexical sorting.

Hope this helps,
Darren :)