On Fri, 2003-08-29 at 08:21, David T-G wrote:
> Kevin --
>
> ...and then K Old said...
> %
> ...
> %
> % The posting a few weeks ago about "for" vs. "foreach" was interesting and got
> % me thinking about warnings.
>
> That sounds really interesting; unfortunately I haven't kept up enough
> to see it. Do you recall some particularly-identifiable text from the
> thread that I could use to search it out?
David,
The posting was "Re: Very slow array searching" by "George P."
<snip>
Or, for the memory conscious,
(since foreach involves loading all elements into memory)
$l_status = 'FALSE';
for (my $i=0; $i < @numbers; $i++)
{
if ($numbers[$i] == $l_number)
{
$l_status = 'TRUE';
last;
}
}
</snip>
I'm not sure how to benchmark this, but would be very interested if
someone knew how. I'd like to see it just for fun.
Hope this helps,
Kevin
--
K Old <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]