in reply to extracting a list element
> delete may also be used on arrays and array slices, but its behavior is less straightforward. Although " exists" will return false for deleted entries, deleting array elements never changes indices of existing values ; use shift or splice for that.
DB<8> $a[0][0] = ['00', '01']; DB<9> $a[0][1] = ['10', '11']; DB<10> x splice @{$a[0]},0,1 0 ARRAY(0xb40000795febe168) 0 00 1 01 DB<11> x @a 0 ARRAY(0xb40000795febbdf8) 0 ARRAY(0xb40000795fee4240) 0 10 1 11 DB<12>
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: extracting a list element
by geoffleach (Scribe) on Jan 05, 2024 at 18:53 UTC | |
|
Re^2: extracting a list element
by jo37 (Curate) on Jan 06, 2024 at 13:40 UTC | |
by LanX (Saint) on Jan 06, 2024 at 18:05 UTC | |
by LanX (Saint) on Jan 06, 2024 at 14:00 UTC |