Re: Difference between for & foreach loop

2009-05-25 Thread Chas. Owens
On Mon, May 25, 2009 at 23:50, sanket vaidya wrote: snip > So to conclude > 'for' & 'foreach' are the two different ways to write same thing & there is > no particular advantage of using one over other. > > Group, correct me if I am wrong. snip I wouldn't say there is no advantage; for is four ch

RE: Difference between for & foreach loop

2009-05-25 Thread sanket vaidya
-Original Message- From: Randal L. Schwartz [mailto:mer...@stonehenge.com] Sent: Monday, May 25, 2009 10:10 PM To: beginners@perl.org Subject: Re: Difference between for & foreach loop >>>>> ""sanket" == "sanket vaidya" writes: &quo

Re: Difference between for & foreach loop

2009-05-25 Thread Randal L. Schwartz
> ""sanket" == "sanket vaidya" writes: "sanket> What is the difference between the 'for' & 'foreach' loops? I know that they "sanket> can be used interchangeably then what is the purpose of keeping them "sanket> separate? Can anyone suggest me a good url which can tell the difference "sanke

Re: Difference between for & foreach loop

2009-05-25 Thread Chas. Owens
On Mon, May 25, 2009 at 03:16, Gunnar Hjalmarsson wrote: > sanket vaidya wrote: >> >> What is the difference between the 'for' & 'foreach' loops? I know that >> they >> can be used interchangeably then what is the purpose of keeping them >> separate? > > The _words_ 'for' and 'foreach' can be used

Re: Difference between for & foreach loop

2009-05-25 Thread Gunnar Hjalmarsson
sanket vaidya wrote: What is the difference between the 'for' & 'foreach' loops? I know that they can be used interchangeably then what is the purpose of keeping them separate? The _words_ 'for' and 'foreach' can be used interchangeably in foreach loops, but a true for loop is something else.

Re: Difference between for & foreach loop

2009-05-25 Thread Erez Schatz
2009/5/25 sanket vaidya : > What is the difference between the 'for' & 'foreach' loops? There is none. http://perldoc.perl.org/perlsyn.html#Foreach-Loops : "The foreach keyword is actually a synonym for the for keyword, so you can use foreach for readability or for for brevity. (Or because the