in reply to randomize array
to interchange the elements, you are missing a step or two. You need to do something like:@$array[$i,$j] = @$array[$j,$i];
Update:I stand corrected - Thanks, Thelonius. Please Ignore this node. <Feeble_excuse>Late night brain block did not process the array-ref-slice syntax correctly</Feeble_excuse>.my $temp = $array->[$i,$j]; $array->[$i,$j] = $array->[$j,$i]; $array->[$j,$i] = $temp;
"For every complex problem, there is a simple answer ... and it is wrong." --H.L. Mencken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: randomize array
by Thelonius (Priest) on Mar 29, 2006 at 06:31 UTC |