Using a named variable on foreach loops is often a good idea from a readability standpoint, but the parent reply makes it sound like it will change the behavior. This is not true. foreach automatically localizes the index variable if it is a global. See perlsyn.