AWK should have a variadic function for array creation. Currently if you wish to
create an array, you must use this:
dd[1] = "aa"
dd[2] = "bb"
dd[3] = "cc"
Or:
split("aa bb cc", dd)
the split syntax is problematic if your elements contain spaces. That can be
worked around by using a custom separator:
split("aa bb\1cc", dd, "\1")
but then it will fail again if your separator happens to be part of one of the
elements. Many other languages have syntax for array literals, for example C:
AWK should have a variadic function for array creation. Currently if you wish to create an array, you must use this:
Or:
the split syntax is problematic if your elements contain spaces. That can be worked around by using a custom separator:
but then it will fail again if your separator happens to be part of one of the elements. Many other languages have syntax for array literals, for example C:
Python:
JavaScript:
Ruby:
Go:
with AWK, it could look like one of these: