> From: "Conrad, Bill (ThomasTech)"
> Subject: foreach question
> 
> Give a foreach loop
> 
> foreach $entry ( @list ) {
> 
> }
> 
> Is there a way to get the position index within @list $entry is from
> without counting the iterations of the loop

What I do when I need to know what element I'm dealing with is this:

for ($i=0; $i<=$#list; $i++) {
   # do something with $list[$i]
}

Hope this helps.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to