in reply to for loop trouble
Your $hit variable is undefined if your $orth variable doesn't match /^A(\d+)/. You might want to check for that.
Also, you seem to come from a C-like programming language. The loop could be written in a shorter, less error-prone way as
push @hits, grep {/$hit/} @pids; push @potential_hgt, grep {! /$hit/} @pids;
There also is a module which implements the part function, which divides one list into two (or more) lists, which would be quite handy here, but I don't find that module at the moment.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: for loop trouble
by fishbot_v2 (Chaplain) on Aug 12, 2005 at 13:00 UTC | |
|
Re^2: for loop trouble
by Roy Johnson (Monsignor) on Aug 12, 2005 at 15:03 UTC |