On Sunday 02 September 2001 01:47 pm, raptor wrote:
> As we read in Damian Conway- Perl6-notes, there will by a var-iterator
> that can be used to see how many times the cycle has been "traversed" i.e.
>
> foreach my $el (@ary) {
> .. do something ....
> print $#; <--- print the index (or print $i )
> }
>
> shall we have :
>
> foreach my $el (@ary) {
> print $# if $#.first(); <--- print the index on the first iteration
I think it's just a simple counter.
print $# if $# == 0;
> i.e. 1
0
> .. do something ....
> print $# if $#.last(); <--- print the index on the first iteration
I don't know if (and if so, how) you would see if you were on the last
iteration. (And would that be last, as in the very last argument passed in,
or last, as in you're not going to iterate again?)
--
Bryan C. Warnock
[EMAIL PROTECTED]