[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] Push/pop and guranteed order?



On Thu, Dec 08, 2005 at 04:27:41PM -0600, Daniel Linder (dan@linder.org) wrote:
> When I push values to an array, am I guranteed that they will be
> returned in the same order when I use "foreach"?

Yes.  An array is ordered.  Hashes are not.

> If not, is there an easy way to create a FIFO (First In, First Out)
> array?  I don't want to resort to creating a key/value pair (i.e.
> key/value: 1:A, 2:B, 3:C,...,26:Z) and have to sort on the key.

Are you coming to Perl from having used PHP?

xoa

-- 
Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance