state-o-dis-array has asked for the wisdom of the Perl Monks concerning the following question:
Each time the script runs, the array is rewritten to up to about 1000 times with the number of elements ranging from about 200-600. Each element of the array has the form "X12:345" I am comparing $element and $compare to find a match such that if $element = X12:345, I want to find $compare = X0:344 or $compare = X24:344. Any suggestions as to how I can make this more efficient would be greatly appreciated. Thanks.foreach $element(@array){ foreach $compare(@array){ if ($element == $compare){next} <see if $element and $compare meet requirements> } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: recursive array search
by Limbic~Region (Chancellor) on Oct 01, 2004 at 19:58 UTC | |
by state-o-dis-array (Hermit) on Oct 01, 2004 at 20:11 UTC | |
|
Re: recursive array search
by Rhys (Pilgrim) on Oct 01, 2004 at 19:46 UTC | |
|
Re: recursive array search
by tmoertel (Chaplain) on Oct 01, 2004 at 20:03 UTC | |
|
Re: recursive array search
by stvn (Monsignor) on Oct 01, 2004 at 19:56 UTC | |
|
Re: recursive array search
by Zaxo (Archbishop) on Oct 01, 2004 at 20:02 UTC |