in reply to Re: Re: While but not for clobbers $_
in thread While but not for clobbers $_
I whole heartedly agree.
Whilst there are many conveniences that come from using $_, I doubt that there are many times when the benefits outweight the dangers of using 'it' nested like that. In this case I would definately name the variable on the for loop--BUT, I might explicitly localise $_ in the while loop also.
The convenience of using 'it' within the body of the while loop when parsing files greatly simplifies and IM(NS)HO greatly clarifies the code.
Explicitly localising it myself goes some way to reducing the potential for it tripping me up, and I can't see any downsides in doing so--even the extra 8 chars is too little to concern the lazy typists:)
|
|---|