Line | |
---|
1 | # fnparydl.awk --- check that deleting works with arrays
|
---|
2 | # that are parameters.
|
---|
3 | #
|
---|
4 | # Tue Jul 11 14:20:58 EDT 2000
|
---|
5 |
|
---|
6 | function delit(a, k)
|
---|
7 | {
|
---|
8 | print "BEFORE LOOP"
|
---|
9 | for (k in a) {
|
---|
10 | print "DELETING KEY", k
|
---|
11 | delete a[k]
|
---|
12 | }
|
---|
13 | print "AFTER LOOP"
|
---|
14 | }
|
---|
15 |
|
---|
16 | BEGIN {
|
---|
17 | for (i = 1 ; i <= 7; i++) {
|
---|
18 | q[i] = sprintf("element %d", i)
|
---|
19 | x[i] = i
|
---|
20 | y[i] = q[i]
|
---|
21 | }
|
---|
22 | # adump(q)
|
---|
23 | delit(q)
|
---|
24 | # for (i in q)
|
---|
25 | # delete q[i]
|
---|
26 | j = 0;
|
---|
27 | for (i in q)
|
---|
28 | j++
|
---|
29 | print j, "elements still in q[]"
|
---|
30 | # adump(q)
|
---|
31 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.