I am catching this thread late so this may have been covered. But can you give me some examples?
I use foreach for arrays. For for loops where I need to maintain a count and have a criteria on the iterations. > -----Original Message----- > From: Rob Dixon [mailto:[EMAIL PROTECTED] > Sent: Friday, December 19, 2003 8:59 AM > To: [EMAIL PROTECTED] > Subject: Re: foreach > > > Bob Showalter wrote: > > > > Jeff Westman wrote: > > > Eric Walker <[EMAIL PROTECTED]> wrote: > > > > > > > I got it so I need a counter which sends me to a for > loop instead > > > > of a foreach. Thanks.. > > > > > > > > perlknucklehead > > > > > > I believe that 'for' and 'foreach' are completely > interchangable. I > > > remember reading somewhere that one was a synonym for the other. > > > > Yes, it's documented in perldoc perlsyn. I never write it as > > "foreach". But I never use csh either. > > Hi Bob. > > That's fair enough, as long as you have a consistent convention. I use > > for (EXPRESSION; EXPRESSION; EXPRESSION) > > and > > foreach (LIST) > > unless the list has only one element, when I use > > for (EXPRESSION) > > to alias $_ with the expression for the extent of the block. > > Cheers, > > Rob > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>