1mNAME0m
       set - Read and write variables

1mSYNOPSIS0m
       1mset 4m22mvarName24m ?4mvalue24m?


1mDESCRIPTION0m
       Returns the value of variable 4mvarName24m.  If 4mvalue24m is specified, then set
       the value of 4mvarName24m to 4mvalue24m, creating a new variable if  one  doesn't
       already  exist,  and  return  its  value.   If 4mvarName24m contains an open
       parenthesis and ends with a close parenthesis, then  it  refers  to  an
       array  element:   the  characters before the first open parenthesis are
       the name of the array, and the characters between the  parentheses  are
       the index within the array.  Otherwise 4mvarName24m refers to a scalar vari-
       able.

       If 4mvarName24m includes namespace qualifiers  (in  the  array  name  if  it
       refers  to  an  array  element), or if 4mvarName24m is unqualified (does not
       include the names of any containing namespaces)  but  no  procedure  is
       active,  4mvarName24m  refers  to a namespace variable resolved according to
       the rules described under 1mNAME RESOLUTION 22min the 1mnamespace 22mmanual page.

       If  a  procedure  is  active  and  4mvarName24m is unqualified, then 4mvarName0m
       refers to a parameter or local variable of the procedure,  unless  4mvar-0m
       4mName24m  was  declared  to  resolve differently through one of the 1mglobal22m,
       1mvariable 22mor 1mupvar 22mcommands.

1mEXAMPLES0m
       Store a random number in the variable 4mr24m:
              1mset 22mr [expr rand()]

       Store a short message in an array element:
              1mset 22manAry(msg) "Hello, World!"

       Store a short message in an array element specified by a variable:
              1mset 22melemName "msg"
              1mset 22manAry($elemName) "Hello, World!"

       Copy a value into the variable 4mout24m from a variable whose name is stored
       in  the  4mvbl24m  (note  that  it is often easier to use arrays in practice
       instead of doing double-dereferencing):
              1mset 22min0 "small random"
              1mset 22min1 "large random"
              1mset 22mvbl in[expr {rand() >= 0.5}]
              1mset 22mout [1mset 22m$vbl]


1mSEE ALSO0m
       expr(n),  global(n),   namespace(n),   proc(n),   trace(n),   unset(n),
       upvar(n), variable(n)


1mKEYWORDS0m
