ORDEREDHASH

ORDEREDHASH

The ORDEREDHASH function creates a new ordered hash. An ordered hash is a compound data type that contains key-value pairs of different data types, including any mixture of scalars, arrays, structures, pointers, object references, dictionaries, lists, hashes, and other ordered hashes. Unlike HASH, the keys in an ordered hash are kept in the same order in which they are inserted.

Ordered hashes have the following properties:

Elements in an ordered hash are kept in their insert order and are indexed by a scalar key.

The key can be a scalar string or number. String keys are case sensitive unless the FOLD_CASE keyword is set.

You can retrieve elements using the bracket array notation.

Ordered hashes can change their size, growing and shrinking as elements are added or deleted.

Unlike structures, with an ordered hash you can change the data type of a value without a performance penalty.