--On Samstag, 22. September 2001 12:26 -0800 Michael Fowler
<[EMAIL PROTECTED]> wrote:
> On Sat, Sep 22, 2001 at 03:27:01AM +0200, birgit kellner wrote:
>> --On Samstag, 22. September 2001 01:09 +0200 Andrea Holstein
>> > Simple solution is
>> > ...
>> > my $index = 0;
>> > foreach my $element (@array) {
>> > if (...) {
>> > ...
>> > }
>> > $index++;
>> > }
>> >
>
>> Thanks, but I don't understand how this is supposed to achieve what I
>> want. As I understand it, this code simply increments the value of
>> $index every time the condition evaluates true.
>
> Then you don't understand it. Notice the $index increment is outside the
> if block. That means it is incremented each time through the loop,
> regardless of the conditional.
>
Right - now I got it. Thanks to Andrea for the solution, and thanks to
Michael for the explanation.
Birgit Kellner
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]