in reply to Inverse slices
Better how?
Shorter? Put the code in a sub.
More readable? Put the code in a sub.
Faster? Sort the indexes and use a merge sort-like approach written in C to filter out the unwanted elements.
Alternative approach if the array only has defined elements:
my @invslice = @array; @invslice[ @slice_idx ] = (); @invslice = grep defined, @invslice;
Update: Replaced undef @invslice[ @slice_idx ]; (which doesn't work) with @invslice[ @slice_idx ] = ();.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Inverse slices
by ysth (Canon) on Nov 01, 2024 at 01:06 UTC | |
by Anonymous Monk on Nov 19, 2024 at 00:23 UTC | |
by ikegami (Patriarch) on Nov 19, 2024 at 17:51 UTC |