http://www.perlmonks.org?node_id=304269


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

Please note that shift does not populate $_ by default, so ajdelore's "Another way to do it" is not. The assignment still has to be explicit.