note
oko1
<p>
<blockquote><em>Declaring a variable twice isn't an error, just unnecessary</em></blockquote>
</p>
<p>
Declaring a variable twice in the same scope is indeed an error - and of exactly the same type as 'strict' is supposed to prevent. Perl may not throw a warning about it as a default behavior, but that does not make it not an error. Is there ever a situation in which declaring a variable twice in the same scope is useful? Conversely, is there ever a time when doing so will not cause problems?
</p>
<p>
It seems to me that reasonable answers to both of the above questions imply that this should indeed be a feature in "strict" - if not in Perl itself. It would have rather obvious positive effects, and no negative ones that I can think of.
</p>
<div class="pmsig"><div class="pmsig-581144">
<pre>--
I hate storms, but calms undermine my spirits.
-- Bernard Moitessier, "The Long Way"</pre>
</div></div>
956175
956181