in reply to Re^4: Regex to array
in thread Regex to array
Why? To make a slice in this case ...
The particular case I had in mind was the
(undef, my %section) = split /(SECTION \d+)/, $text;
statement dealing with return values from the split built-in function, and I agree that in this kind of case, assignment to undef is reasonable and IMHO preferable.
However, I was trying to make the additional point that this kind of assignment works with any array or list assignment, e.g.,
and that in this sort of case it's (usually) better to use some kind of slice, e.g.,c:\@Work\Perl\monks>perl -wMstrict -le "my @ra = qw(zero one two three four five); ;; my (undef, undef, $x, $y) = @ra; print qq{'$x' '$y'}; " 'two' 'three'
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Regex to array
by Eily (Monsignor) on Jan 10, 2018 at 09:20 UTC |