> -Original Message-
> From: Stephen P. Potter [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 07, 2001 1:37 PM
> To: Bob Showalter
> Cc: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
> Subject: Re: foreach and the ordering of array's
>
>
>
Lightning flashed, thunder crashed and Bob Showalter whispered:
| One way to supply a list to for/foreach is to use the keys() function
| to retrieve a list of the keys in a hash. keys() does not return the
| key values in any particular order, due to the internal representation
| of a hash.
I t
Lightning flashed, thunder crashed and Jeffl <[EMAIL PROTECTED]> whispere
d:
| 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 th
Lightning flashed, thunder crashed and Jeffrey Loetel <[EMAIL PROTECTED]>
whispered:
| Question:
| When you extract a value from an @ are you guarenteed the order that
| you are going to get?
In both cases, @ and %, you will always get a predictable order. With
arrays, it will always be ordere
owalter
> > Cc: 'beginners @ perl . org'
> > Subject: RE: foreach and the ordering of array's
> >
> >
> > 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
> -Original Message-
> From: Jeffl [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 07, 2001 11:47 AM
> To: Bob Showalter
> Cc: 'beginners @ perl . org'
> Subject: RE: foreach and the ordering of array's
>
>
> when you run a foreach on a ha
> -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 extrac
> -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 guar
Question:
When you extract a value from an @ are you guarenteed the order that
you are going to get?
Example:
foreach $value (@some_array) {
#do something to $some_array[0]
#on the next pass through the foreach and the @some_array
#do something to $some_array[1]
#