Hi all,

Awk has two kinds of variables: scalars which are strings or ints or
floats, and arrays. Arrays are more like LUA tables or Python dicts or
Perl hashes in that you can use any scalar as a subscript.
Multidimensional arrays are doable but require care and attention.

The following code crashes, complaining that you're using array a in a
scalar context:

a[1] = "whatever"
b = a

A deepcopy operation is the only real way to copy an array in awk. So
I've written deepcopy.awk as a demonstration of a working awk deepcopy
function. See the code at
http://troubleshooters.com/codecorn/awk/stuff/deepcopy.awk
 
SteveT

Steve Litt 
April 2018 featured book: Troubleshooting Techniques
     of the Successful Technologist
http://www.troubleshooters.com/techniques
_______________________________________________
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Reply via email to