Next: , Previous: Multidimensional, Up: Arrays  
[Contents][Index]  8.6 Arrays of Arrays  gawk goes beyond
standard awk’s multidimensional array access and provides true
arrays of arrays. Elements of a subarray are referred to by
their own indices enclosed in square brackets, just like the
elements of the main array. For example, the following creates a
two-element subarray at index 1 of the main array a:  a[1][1] =
1 a[1][2] = 2  This simulates a true two-dimensional array. Each
subarray element can contain another subarray as a value, which
in turn can hold other arrays as well. In this way, you can
create arrays of three or more dimensions. The indices can be
any awk expressions, including scalars separated by commas
(i.e., a regular awk simulated multidimensional subscript). So
the following is valid in gawk:  a[1][3][1, "name"] = "barney"
Each subarray and the main array can be of different length. In
fact, the elements of an array or its subarray do not all have
to have the same type. This means that t