Re: RFC 120 (v2) Implicit counter in for statements, possibly $#.
[email protected] ("David L. Nicol") Thu, 17 Aug 2000 20:39:43 -0500
| Newsgroups | perl.perl6.language.flow |
|---|---|
| Organization | University of Missouri - Kansas City supercomputing infrastructure |
| Message-ID | <[email protected]> |
"Christopher J. Madsen" wrote:
> Why not use an explicit counter instead? Something like
>
> foreach $item $index (@array) {
>
> (This is a syntax error in Perl5.)
Why not use an explicit perl5 counter?
my $index;
foreach $item (@array){ $index++;
print $item, " is at index ", $index, "\n";
}