when you run a foreach on a hash you have no idea what order you will get
the keys unless
you sort it, then you can only get it in the order defined by sort. If you
use Tie::IxHash
on a hash you can print out the has in the order it was constructed.
Basically, I couldn't remeber what the Camel said about foreach and
accessing an array.
I went back and found this, which ties into what I had thought...(quote
from the camel v.3
pg.118) "There is no way with foreach to tell where you are in a list. You
may compare adjacent elements by remembering the perevious one in a
variable, but sometimes you just have to break down and write a three-part
for loop with subscripts."
So basically, what I get out of this, is that you don't know the order that
foreach will retrieve the elements of the '@'. Now I could be mistaken
here, and am not seeing the forest for the trees, and I should have just
run a test to find out for myself.....I'm off to go build an @ and find out
the order it parses through in a foreach, which I should have done in the
first place......doh.....It was late......cut me some slack.
jeffl
On 2001.09.07 10:18 Bob Showalter wrote:
> > -----Original Message-----
> > From: Jeffrey Loetel [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, September 07, 2001 1:57 AM
> > To: [EMAIL PROTECTED]
> > Subject: foreach and the ordering of array's
> >
> >
> > Question:
> > When you extract a value from an @ are you guarenteed the order that
> > you are going to get?
>
> Yes. Why do you suspect that you may not?
>
> --
> 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]