in reply to Array wierdness
This seems to be a bug surprising side-effect of non-strict code to me. First you assign the numbers to both arrays in one go. Then, you use these numbers as (symbolic) references when you by using the arrays as multi-dimensional. Perl then uses the arrays @1, @2 etc. , and these arrays are shared between @PP and QQ.
This is surprising.
Note that using 'strict' would have allowed Perl to tell you that you are implicitly upgrading/changing numbers to references:
Can't use string ("1") as an ARRAY ref while "strict refs in use at .. +.
Update: Updated my explanation to what actually happens, after a conversation with haarg
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Array wierdness
by lgp (Initiate) on Apr 25, 2022 at 14:30 UTC | |
by Animator (Hermit) on Apr 25, 2022 at 15:36 UTC | |
by pryrt (Abbot) on Apr 25, 2022 at 15:34 UTC | |
by Discipulus (Canon) on Apr 26, 2022 at 09:04 UTC | |
by hv (Prior) on Apr 26, 2022 at 09:13 UTC | |
by LanX (Saint) on Apr 26, 2022 at 10:25 UTC |