S
Samwyse
I have two arrays of equal length that contain null values. I want one
array with fewer nulls. This almost works:
push @t, shift(@f).shift(@g) while scalar @f;
except that every once in a while both arrays have values in the same
slot. This won't work at all:
push @t, shift(@f)||shift(@g) while scalar @f;
because the || operator short-circuits. Can anyone do this in one line,
or do I need do it the hard way:
while (scalar @f) {
($a, $b) = (shift(@f), shift(@g));
push @t, $a || $b;
}
array with fewer nulls. This almost works:
push @t, shift(@f).shift(@g) while scalar @f;
except that every once in a while both arrays have values in the same
slot. This won't work at all:
push @t, shift(@f)||shift(@g) while scalar @f;
because the || operator short-circuits. Can anyone do this in one line,
or do I need do it the hard way:
while (scalar @f) {
($a, $b) = (shift(@f), shift(@g));
push @t, $a || $b;
}