Re: for/foreach question

2003-07-24 Thread david
"Hemant Desai" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > perl -MO=Deparse -e 'for $i (1..4){;}' > is the -MO=Deparse option explained anywhere ? yes. [panda]$ perldoc perlcompile NAME perlcompile - Introduction to the Perl Compiler-Translator DESCRIPTION Perl has alw

Re: for/foreach question

2003-07-24 Thread Steve Grazzini
On Fri, Jul 25, 2003 at 10:32:14AM +0530, Hemant Desai wrote: > perl -MO=Deparse -e 'for $i (1..4){;}' > is the -MO=Deparse option explained anywhere ? % perldoc O % perldoc B::Deparse The -M switch adds a "use Module" statement to your code. -- Steve -- To unsubscribe, e-mail: [EMAIL

RE: for/foreach question

2003-07-24 Thread Hemant Desai
perl -MO=Deparse -e 'for $i (1..4){;}' is the -MO=Deparse option explained anywhere ? -Original Message- From: david [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2003 11:34 PM To: [EMAIL PROTECTED] Subject: Re: for/foreach question Peter Fleck wrote: > I just stumb

Re: for/foreach question

2003-07-24 Thread awarsd
Hi, I think it is good to have foreach and for loop even tough they are the same if you are searching in a file you can almost make a sentence foreach $line(@infile) #<-- to me this is more readable than for $line(@infile) But for loop, I use it only for numbers for(1..53) or for( $i=0;$i<50;$i++)

Re: for/foreach question

2003-07-24 Thread david
Peter Fleck wrote: > I just stumbled upon this in some perl I'm working on: > > for $arrayref (@datedbi) { > #do stuff > } > > It didn't look right and sure enough, it should be 'foreach'. > > But it worked fine and that's my question - why is this working? > > @datedbi's elements are refe

Re: for/foreach question

2003-07-24 Thread Jeff 'japhy' Pinyan
On Jul 24, Peter Fleck said: >for $arrayref (@datedbi) { >#do stuff >} > >It didn't look right and sure enough, it should be 'foreach'. > >But it worked fine and that's my question - why is this working? In Perl, 'for' and 'foreach' are the EXACT SAME THING. for $x (@list) ... foreach $x