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.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to