Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2006-07-02
09:20 • Closed ticket [1507938fff]: array names -exact option malfunction plus 6 oth... artifact: 909dcca661 user: sf-robot
2006-06-18
06:44 • Pending ticket [1507938fff]. artifact: 0a6d9efe89 user: msofer
06:44 • Ticket [1507938fff]: 4 changes artifact: 20b37863ea user: msofer
06:06 • Ticket [1507938fff]: 4 changes artifact: 910c2ba42b user: blacksqr
2006-06-17
23:04 • New ticket [1507938fff]. artifact: a375bd724d user: blacksqr

array names -exact option malfunction

Closed / Invalid1507938fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2006-06-17 23:04:33
The -exact option of the "array names" command
malfunctions if there is an asterisk in the array
element name:

% array set test1 "name* value1"
% array set test1 "name value2"
% array get test1
name value2 name* value1
% array names -exact test1 name* ; # expect "name*" ,
get empty string
% array names test1 name\\*
name*

------

As a general principal, I would like to be able to use
arbitrary inputs as array element names, without having
to have to escape out glob characters to get the values
I want; that means I wish there were a functioning
"-exact" option for the array "get" and "unset"
commands as well as for "names"
blacksqrplain2006-06-18 06:06:54
Logged In: YES 
user_id=128673

Platform: Windows XP
msoferplain2006-06-18 06:44:04
Logged In: YES 
user_id=148712

The correct syntax is
  array names arrayName ?mode? ?pattern?
It works alright here if you do
  array names test1 -exact name*

There might still a bug in there: even though the man page
states that "If there are no (matching) elements in the
array, or if arrayName isn't the name of an array variable,
then an empty string is returned.", your command might be
expected to error out with a message
  bad option "test": must be -exact, -glob, or -regexp
Note that is looking for the names of elements of the array
named '-exact', with an option 'test' and a pattern 'name*'.

As to the feature requests: please submit them in a separate
ticket under "Feature Requests". Or, even better, submit a
TIP (http://wiki.tcl.tk/983).
msofer Pending ticket [1507938fff]. [History diff]2006-06-18 06:44:05
sf-robotplain2006-07-02 09:20:12
Logged In: YES 
user_id=1312539

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
Log in (anonymous is fine) to add a comment.