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
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
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
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,
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
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/
> 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/
> 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
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
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
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
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
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
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
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
15 matches
Mail list logo