Yes, for and foreach will select the elements of the array starting at 0
and ending at the last element.
It is the %hash that you are thinking of that does not read data in the
order in which they were put into it...
HTH,
Brent
Mooney
Christophe-CM To: [EMAIL PROTECTED]
OONEY1 cc:
<CMOONEY1@mot Subject: does foreach choose in order?
orola.com>
08/08/01
10:46 AM
I need to read elements from @blah from "left-to-right" (ie. in the order
that successive shifts would read them). I seem to remember reading
somewhere that one should use 'for' only when s/he doesn't care about the
order in which the elements are chosen. However, every time i try 'for
(@blah)', it reads "left-to-right".
In other words, is
for (@blah)
{
whatever($_);
}
effectively equivalent to
for ($i=0;$i<@blah;$i++)
{
whatever($blah[$i]);
}
?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]