in reply to Re: Nested Conditional Statement Issue
in thread Nested Conditional Statement Issue
If that guess is wrong you could always just loop over the range 0..$cleng-1, or else 0..$cleng. (Although almost certainly my guess is right and you just want to loop over the @course array.)for (@class) { my ($id, $name, $credits) = split(/,/, $_); for my $course (@course) { $z++ if $course eq $id; } }
And another tip to the original questioner. If you find yourself scanning arrays like this, that is usually a sign that you wanted to use a far more efficient hash lookup instead.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re (tilly) 2: Nested Conditional Statement Issue
by Anonymous Monk on May 07, 2001 at 03:09 UTC |