Data Representation in Tcl - Lists (aka arrays)

The list is nothing more than a string with, as elements separator, the space.

% set list {12 {78 5} 45 "I am not a number"} (there are only 4 elements in this list)
12 {78 5} 45 "I am not a number" (Tcl echoes back the list)

% set sublist1 [lindex $list 1] (creating a sublist from list using list index starting from 1, remember the index references begin at 0)
78 5 (sublist created, and echoes back its contents, after all everything is a string)

% set sublist2 [lindex $list 3]
I am not a number

% lindex $sublist2 2 (this extracts the 2nd element from the sublist2, which is word 'not')
not (echoes the string)

Go to Tcl-page 6... Back to Tcl-page 4... Starting page