petdance,
I tend to pay close attention to people who have had a fair amount of experience. When I first read what you wrote, I got a little nervous because I often use
foreach loops without specifying a looping variable. I thought about it a bit, and just about everything in perl that sets $_ localizes it first like
map,
grep,
foreach loops, etc (
while loops excluded). I didn't do an exhaustive search (checked the CB) but the list was quite short of things that I found that modify $_:
Since $_ is aliased, I am intentionally changing $_ if I use one of those. Am I completely missing the boat here? I am not saying there isn't any case where this can't bite you but is it more common than I think or are you just protecting against Murphy's Law?