Re: missing values from files
- From: rob.dixon@xxxxxxx (Rob Dixon)
- Date: Mon, 30 Jul 2007 20:27:34 +0100
Chas Owens wrote:
On 7/30/07, John W. Krahn <krahnj@xxxxxxxxx> wrote:Chas Owens wrote:snipOn 7/30/07, Isha M. Renta <isha.renta@xxxxxxxxx> wrote:It would probably be better to use:The 13 is the counter for the $inittime array (which actually have 13snip
numbers and not 15 as it seems) and the 3600 is the number of lines in all
the files. All the files have 3600 lines.
Isha
Then you have an off-by-one error. You are saying
for($j=0;$j<=13,$j++) {
This will loop 14 times, not 13 times. This is why C-style for loops
are bad. Don't use them. If you want to loop over an array use the
iterating version of for:
for my $element (@array) {}
If you want to loop over a range you still should use the iterating
version of for:
for my $j (1 .. 13) {}
for my $j ( 0 .. $#array ) {}
No, that is almost always better written as
for my $element (@array) {}
That is a completely different loop. And I think John's point was that
it would be better to use $#array than to hard-code 13.
Rob
.
- References:
- Re: missing values from files
- From: Irenta
- Re: missing values from files
- From: Prabu Ayyappan
- Re: missing values from files
- From: Isha M. Renta
- Re: missing values from files
- From: Chas Owens
- Re: missing values from files
- From: John W. Krahn
- Re: missing values from files
- From: Chas Owens
- Re: missing values from files
- Prev by Date: Re: missing values from files
- Next by Date: Re: ASCII::Plot::Scatter namespace
- Previous by thread: Re: missing values from files
- Next by thread: Re: missing values from files
- Index(es):
Relevant Pages
|