(bin) 1 % set bar {x[y]}
x[y]
(bin) 2 % set foo($bar) test
test
(bin) 3 % parray foo
foo(x[y]) = test
(bin) 4 % array unset foo $bar
(bin) 5 % parray foo
foo(x[y]) = test
His claim was that you couldn't unset array elements whose names
contained square brackets. I pointed him to the array man page, which
says that [array unset] uses the rules of [string match], to which
square brackets are significant. Then I showed him:
(bin) 6 % unset foo($bar)
(bin) 7 % parray foo
(bin) 8 %
A simple problem, but possibly a "gotcha". My first thought was that he
must be doing something to evaluate the [].
Hm, but the pattern would be * as you do not specify any special
one, so that should match anything. Odd
Regards,
Arjen
Oh, missed a piece of information :-} You do give a pattern.
Yes, glob patterns can contain ranges - like "x[y]" ...
Regards,
Arjen
You could also do:
% array unset foo [string map {[ \\[ ] \\]} $bar]
--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+