in reply to Re: shift split grep question (updated)
in thread shift split grep question
Rather than splice you can use undef to ignore unwanted elements. Like this: my (undef, @headings) = split ' ', first {/^\s*AUID/} @lines;
Going further (it's not related to the OP anymore) it works exactly as if there was one scalar in that place that was then ignored. So in the following example: (undef, $second, undef, $hash{fourth}, @rest, undef) = some_function() The first and third values are ignored, the second and fourth get in $second and $hash{fourth}, but @rest gets all the following values, and the last undef is useless. So it let's you ignore values counting from the left, but never couting from the right.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: shift split grep question
by haukex (Archbishop) on Nov 25, 2018 at 20:04 UTC |