Actually, I do use "for" for C-style iterations and "foreach" for the more Perlish iterator loops! I like to use what "feels" right
Did you read the post to which you replied? ("Why is it always C-style loops (usually used as counting loops) vs list iterator loops? Perl-style counting loops are always ignored.")
So what do you use for Perl-style for loops?
for (1..5) { say; } foreach (1..5) { say; }
Quite frankly, I wish they were distinct so we could discourage "for" loops and encourage "foreach" loops without any ambiguity
For loops are very important and should not be discouraged in the least. Just the C-style ones are hard to read.
In reply to Re^8: eof not recognised when applying diamond operator to invocation arguments?
by ikegami
in thread eof not recognised when applying diamond operator to invocation arguments?
by pat_mc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |