in reply to Re^2: Array wierdness
in thread Array wierdness
FWIW, assigning the numbers to the arrays in separate lines makes no difference.
This is because your code's comments are wrong:
# fill two 25 x 25 arrays with zeros, then modify a couple of cells my @PP = my @OO = (1..25);
This does not create 25x25 arrays, this creates 1x25 arrays.
Below shows a 1x25 (what you have) vs a 2x5:
use strict; use warnings; use Data::Dump; my @one_by_twentyfive = (1..25); my @two_by_five = ([1..5],[1..5]); dd \@one_by_twentyfive; dd \@two_by_five; __END__ [1 .. 25] [[1 .. 5], [1 .. 5]]
or this one populates a 25x25 array, then overrides 3 slots:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Array wierdness -- initialize AoA
by Discipulus (Canon) on Apr 26, 2022 at 09:04 UTC | |
by hv (Prior) on Apr 26, 2022 at 09:13 UTC |