Your comment and several others I have seen here suggest that while(FH) and foreach automatically localize $_. But the folowing code seems does not revert to the old $_ after leaving the while loop. What am I missing? Thanks.
in reply to Re: Re: What would you do?
in thread What would you do?
use strict; use diagnostics;
$_ = "Before";
print "Before loop= $_\n";
print "In while loop= $_\n";
print "After while loop= $_\n";
Before loop= Before
myinput (entered from the keyboard)
In while loop= myinput
After while loop= myinput