On Saturday 27 October 2001 03:11 pm, you wrote:


@sorted_a = sort{$a<=>$b}(@numbers_a);

I can then print out the @sorted_a array and the numbers appear on the
screen in order from lowest to highest.  The problem comes next.  I want
to take those ten numbers in ascending order and assign them to
variables again (from lowest to highest.  Here's what my script looks
like:

foreach $anumber (@sorted_a) {
@sorted_field = split (/,/, $anumber);
$randomonea = $sorted_field[0];
$randomtwoa = $sorted_field[1];
$randomthreea = $sorted_field[2];
$randomfoura = $sorted_field[3];
$randomfivea = $sorted_field[4];
$randomsixa = $sorted_field[5];
$randomsevena = $sorted_field[6];
$randomeighta = $sorted_field[7];
$randomninea = $sorted_field[8];
$randomtena = $sorted_field[9];
}

I have a quick simplifying idea for you.

lose some detail at the concept stage of " get ten numbers sorted, then put 
in an array"

A way to do that is use lists
again ...like you did to put values into @numbers_a

for example
$randomonea = $sorted_a[0];
$randomtwoa = $sorted_a[1];
$randomthreea = $sorted_a[2];
$randomfoura = $sorted_a[3];
.
.
.

f
(I am a newbie too, and have not checked syntax of above--for your 
experience...)

..use print staements to showintermediate variable 
contents while debugging your logical flow...

Simplify, simplify....add comments, add high level of abstraction comments 
that concisely say what the outcome is.

John Griessen

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to