[HRPM] nother one

Troy E. Webster twebster at pcs.cnu.edu
Wed Nov 15 14:20:29 CST 2000


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