in reply to Re: How do I localize $_ in while loops?
in thread How do I localize $_ in while loops?

{ local $_; print while (shift @list); }

This doesn't work, because $_ is never assigned to. I think you took it from this example code:

{ local $_; while(<>){ print; } }

This works because the assignment to $_ is taken care of by using angle brackets alone inside the while. I think you meant:

{ local $_; print while ($_ = shift @list); }

--
3dan