in reply to RE (\d+): C Style For and Foreach The Same
in thread Finding the length of an array of arrays

What makes you think I confuse them?

I show them the idiom as I write it and encourage them to write it the same way. If the question of whether they are the same comes up, I just say, "Yeah, they are aliases for each other, but I like to write them differently because I think it is clearer that way." I have yet to see anyone find that a huge hurdle. I have seen getting used to the different type of looping be a hurdle.

As for telling people things up front, do you think that up front I tell people that blocks are really hashes, REs are really done by recursion, or many other minor details of the language? Perl is a big language, with many corners, and you shouldn't present it all at once.

  • Comment on RE: RE (\d+): C Style For and Foreach The Same