[HRPM] nother one

Jeff Rowan jrowan at visi.net
Wed Nov 15 14:54:02 CST 2000


Sorry, no way to do it. It is part of what you give up in using the foreach
syntax. but, you could do a look behind.

/Jeff
----- Original Message -----
From: "Troy E. Webster" <twebster at pcs.cnu.edu>
To: <norfolk-pm-list at happyfunball.pm.org>
Sent: Wednesday, November 15, 2000 3:20 PM
Subject: [HRPM] nother one


> Hey,
>
> This may turn out to be a stupid question, but nothing ventured nothing
> gained...
>
> Is there a way to peek ahead in a foreach loop?
>
> For example, foreach $elem (@array){}
> can I look at $elem+1 while looking at $elem? I realize I can do the same
> type of loop using a while loop and then checking $array[i+1] (where i is
> the current element) but I was curious if there was a way to do it with
> a foreach loop.
>
> Thanks
> Troy
>
>
___________________________________________________________________________
> ``Beware of bugs in the above code; I have only proved it correct, not
> tried it.''  -Don Knuth
> --------------------------------------------------------------------------
-
>
>




More information about the Norfolk-pm mailing list