Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am currently writing a CGI application and have a few lines of code which slow the program down (so it stops) when included. I wondered how I could re-write it so it doesn't cause this problem.
The core of the program is within a foreach ($line) loop so certain variables are'nt defined for each line - I thought I would have got around this problem by using an if-defined test. I would appreciate your advice.
# @array and @numbers both contain numbers. if (defined ($array[0])) { foreach my $num (@numbers) { if ($array[0] == $num) { print "FOUND<P>"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: slow CGI's
by thinker (Parson) on Jul 07, 2003 at 11:18 UTC | |
by jryan (Vicar) on Jul 07, 2003 at 18:29 UTC | |
|
Re: slow CGI's
by bwana147 (Pilgrim) on Jul 07, 2003 at 15:27 UTC | |
by chromatic (Archbishop) on Jul 07, 2003 at 18:14 UTC | |
by saintbrie (Scribe) on Jul 08, 2003 at 04:25 UTC |