in reply to On HTML::Template

A note on how it does work: foreach will check the length of the array it is trying to pull from before it attempts to grab the next item. If the length of the array is ever equal to the next index it is going to pull, it stops. In other words, just like your usual for loop but with all the magical index-tracking stuff implied.

for behaves the same as foreach. perlsyn has this to say: "The foreach keyword is actually a synonym for the for keyword, so you can use foreach for readability or for for brevity."