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

Andy Lester andy at petdance.com
Thu Dec 8 14:33:42 PST 2005


On Thu, Dec 08, 2005 at 04:27:41PM -0600, Daniel Linder (dan at 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 at petdance.com => www.petdance.com => AIM:petdance


More information about the Omaha-pm mailing list