On Fri, Apr 20, 2007 at 01:47:18PM -0400, Chas Owens wrote: > but you > should be more concerned with making what you write clearly express > your intent. This is why I prefer > > my @a = (0 .. 10); > my $i = 0; > for my $elem (grep {not $i++ % 3} @a) { > func($elem); > } > > to > > for (my $i = 0; $i < @a; $i += 3) { > func($a[$i] > } > > The grep clearly states that I am looking for something and its block > tells me what the criteria are.
There are times where this list needs webcams. I'd love to have been able to have seen you as you wrote that since I find it hard to believe that anyone could have done so whilst keeping a straight face ;-) I presume that in your second example you should really be comparing against for (my $i = 0; $i < 10; $i += 3) { func($i); } which just seems so much clearer to me. Fortunately, TIMTOWTDI, but with any luck I won't be maintaining your code ;-) Anyway, there seems to be a little confusion about whether for or foreach were going to be removed from the language. The main point I wanted to make was that foreach is not going away. Neither is for. At least, not in Perl5, which will still be around for a long time. They are still synonyms, and any code written now and using either of these constructs will continue to work under all Perl5 releases. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/