You could modify the line in question like this:
@b = grep { defined $_ } @{[ @a[0..5] ]};
Or even:
@b = grep { defined $_ } @{[@a]}[0..5];
But whatever approach you choose, make sure that you comment it so it's clear why you do it.
In reply to Re: Avoiding vivification with array slice
by betterworld
in thread Avoiding vivification with array slice
by jbert
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |