Previous: Arrays of Arrays, Up: Arrays [Contents][Index]
awk
provides one-dimensional associative arrays
(arrays indexed by string values). All arrays are associative; numeric
indices are converted automatically to strings.
array[indx]
.
Referencing an element creates it if it did not exist previously.
in
operator: ‘indx in array’.
awk
and varies among
implementations. gawk
lets you control the order by assigning
special predefined values to PROCINFO["sorted_in"]
.
awk
.
awk
simulates multidimensional arrays by separating
subscript values with commas. The values are concatenated into a
single string, separated by the value of SUBSEP
. The fact
that such a subscript was created in this way is not retained; thus,
changing SUBSEP
may have unexpected consequences. You can use
‘(sub1, sub2, …) in array’ to see if such
a multidimensional subscript exists in array.
gawk
provides true arrays of arrays. You use a separate
set of square brackets for each dimension in such an array:
data[row][col]
, for example. Array elements may thus be either
scalar values (number or string) or other arrays.
isarray()
built-in function to determine if an array
element is itself a subarray.
Previous: Arrays of Arrays, Up: Arrays [Contents][Index]