Do you mean something like this:
$ perl -le' my @array = "A" .. "H"; my $count = @array; for my $letter ( @array ) { if ( --$count ) { print "Letter: $letter"; } else { print "Last letter: $letter"; } } ' Letter: A Letter: B Letter: C Letter: D Letter: E Letter: F Letter: G Last letter: H
In reply to Re: Perl's feature to determine, in current point of loop, that this is the last one?
by jwkrahn
in thread Perl's feature to determine, in current point of loop, that this is the last one?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |