Re: for loop

2009-11-27 Thread Shawn H Corey
PigInACage wrote: > Hello all. > > I've got a file CSV with 3 column > name,surname,group > > if one of the column has got a space like > Davide,Super Dooper,Group > I cannot use it in a for loop > > for i in `cat list.csv` ; do echo $i ; done > the result is > Davide,Super > Dooper,Group > > h

Re: for loop

2009-11-27 Thread lan messerschmidt
On Fri, Nov 27, 2009 at 6:32 PM, PigInACage wrote: > Hello all. > > I've got a file CSV with 3 column > name,surname,group > > if one of the column has got a space like > Davide,Super Dooper,Group > I cannot use it in a for loop > > for i in `cat list.csv` ; do echo $i ; done > the result is > Dav

Re: for loop

2009-11-27 Thread Steve Bertrand
PigInACage wrote: > Hello all. > > I've got a file CSV with 3 column > name,surname,group > > if one of the column has got a space like > Davide,Super Dooper,Group > I cannot use it in a for loop > > for i in `cat list.csv` ; do echo $i ; done > the result is > Davide,Super > Dooper,Group > > h

Re: For Loop error: Missing $ on loop variable at time.pl line 7.

2007-07-10 Thread Dr.Ruud
Gowtham schreef: > Martin Barth: >>> for my ($index = 0; $index <= 10; $index++) { >>>print ("$hour:$min:$sec\n"); >>> } >> >> for my $index (0..10){ >> print ("$hour:$min:$sec\n"); >> } > > Don't wrap the entire loop initializer, condition and > counter update in my(). [...] Gowtham,

Re: For Loop error: Missing $ on loop variable at time.pl line 7.

2007-07-10 Thread Gowtham
On Jul 10, 9:13 pm, [EMAIL PROTECTED] (Martin Barth) wrote: > > for my ($index = 0; $index <= 10; $index++) { > > > print ("$hour:$min:$sec\n"); > > > } > > for my $index (0..10){ > print ("$hour:$min:$sec\n"); > > } > > hth Don't wrap the entire loop initializer, condition and counter upd

Re: For Loop error: Missing $ on loop variable at time.pl line 7.

2007-07-10 Thread Mr. Shawn H. Corey
CM Analyst wrote: for my ($index = 0; $index <= 10; $index++) { for (my $index = 0; $index <= 10; $index ++ ) { --- Shawn -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: For Loop error: Missing $ on loop variable at time.pl line 7.

2007-07-10 Thread Martin Barth
> for my ($index = 0; $index <= 10; $index++) { > > print ("$hour:$min:$sec\n"); > > } for my $index (0..10){ print ("$hour:$min:$sec\n"); } hth -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

RE: for loop not ending

2004-01-19 Thread Hanson, Rob
> for ($day=$keeplogs+1;$day>$keeplogs;$day++) { Hmmm... lets assume $keeplogs = 60 (right?). The problem is that $day is always going to e greater than $keeplogs, because you initialized day that way. So yes, you need to set an upper bounds. Maybe this. my $max_days_old = 120; # loops from 6

Re: For loop aliasing AND changing an array within a loop.

2003-01-24 Thread Rob Dixon
Hi Michael. Michael Hooten wrote: > While stepping through the code I wrote, I distinctly noted that the > substitution on $_ did NOT affect the array and vice versa. If you watch carefully what Perl is doing, it aliases correctly _until_ you choose to modify the array. After this the correct val

RE: For loop aliasing AND changing an array within a loop.

2003-01-24 Thread Michael Hooten
PROTECTED] Subject: Re: For loop aliasing AND changing an array within a loop. On Wed, Jan 22, 2003 at 02:10:34PM -0800, John W. Krahn wrote: > Zeus Odin wrote: > > I think I read somewhere that you should NOT delete array elements from > > within a loop. However, the following

Re: For loop aliasing AND changing an array within a loop.

2003-01-22 Thread John W. Krahn
Paul Johnson wrote: > > On Wed, Jan 22, 2003 at 02:10:34PM -0800, John W. Krahn wrote: > > > > I think that you are thinking of hashes. > > From perlsyn: > > If any part of LIST is an array, "foreach" will get very > confused if you add or remove elements within the loop > body, for example

Re: For loop aliasing AND changing an array within a loop.

2003-01-22 Thread Paul Johnson
On Wed, Jan 22, 2003 at 02:10:34PM -0800, John W. Krahn wrote: > Zeus Odin wrote: > > I think I read somewhere that you should NOT delete array elements from > > within a loop. However, the following works very well. > > I think that you are thinking of hashes. From perlsyn: If any part of LIS

Re: For loop aliasing AND changing an array within a loop.

2003-01-22 Thread John W. Krahn
Zeus Odin wrote: > > When you loop through an array > >for(@array){ ... } > > should not each array element be aliased into $_: if you change $_, you > also change the element? Yes, that is correct. > This is what I remembered. However, a problem I > just encountered shook this recollectio

Re: For loop...

2001-06-24 Thread Brett W. McCoy
On Sun, 24 Jun 2001, Tim Grossner wrote: > I am using a for (@targets) loop to connect to cisco routers...if the > target is unreachable I need it to go on to the next target in the array > @targets. What should I look for? An "else" statement or what? You can do something like this: for(@targe

Re: For loop...

2001-06-24 Thread Jos I. Boumans
yes, that would be a good idea, to add in control structures.. i wrote a tutorial about them which you can find here: http://www.sharemation.com/~perl/tut alltho they're momentarily down for maintenance (they joy of free webspace) what you're looking for is something like: for(@foo) { if (con