in reply to Re: Re: extracting corresponding values from another array
in thread extracting corresponding values from another array
Likewise. for(;;) is a dirty C trick that doesnt really belong in perl. Especially when the replacement is easier to understand, less prone to error and most importantly more efficient.
And this isnt a valid solution as if the list is empty we get a false return of 0.y @temps = ('69', '70', '71'); my @numbers = ('0.115', '3.667', '4.78'); my $highNumberIndex = 0; for my $i (0..$#number) { if ($numbers[$highNumberIndex] < $numbers[$i]) { $highNumberIndex = $i; } } print $temps[$highNumberIndex];
--- demerphq
my friends call me, usually because I'm late....
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: extracting corresponding values from another array
by Abigail-II (Bishop) on Dec 03, 2002 at 13:09 UTC | |
by demerphq (Chancellor) on Dec 03, 2002 at 15:26 UTC | |
by Abigail-II (Bishop) on Dec 03, 2002 at 16:40 UTC | |
by demerphq (Chancellor) on Dec 04, 2002 at 12:36 UTC | |
by Anonymous Monk on Dec 03, 2002 at 16:50 UTC | |
by Abigail-II (Bishop) on Dec 03, 2002 at 17:05 UTC |