Re: Unbalanced braces in variable names

From: Derk Gwen (derkgwen_at_HotPOP.com)
Date: 10/14/03


Date: Tue, 14 Oct 2003 14:27:10 -0000


# % set string(1 "a string"
# % string length $string(1
#
# Giving this command in tclsh will not work, the command will not
# finish. But
#
# % string length ${string(1}

set knows its second argument is the variable name, and so it figures out some
way to parse it. $ knows that a variable name can follow, and tries to find the
longest prefix that is valid variable. ${...} again knows the entire extent
of the variable name and figures out a way to parse it.

--
Derk Gwen http://derkgwen.250free.com/html/index.html
The whole world's against us.


Relevant Pages

  • Looking for ideas as to how I could do this.....
    ... this string, I would process (i.e. parse) that line to put the data into a ... I had a function that was working on windows xp/2000 machines which was ... the process use COMMAND.COM, I get errors in the find command. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: CommandLineToArgvA?
    ... distinct multibyte args? ... The string I want to ... parse is not a command line but I want to treat it exactly like a command line ...
    (microsoft.public.vc.language)
  • Re: Not available in Maple 9 anymore: save all variables once
    ... I've tried to use the parse command to build a "save all" ... word save in the string. ... >> have a symbol or string with a maple command, ...
    (sci.math.symbolic)
  • [HPADM] Scripting Question
    ... I am trying to write a script that will take output from a command or ... parse a file to get certain information from within the output or file. ... ends when it matches another given string. ...
    (HP-UX-Admin)
  • TIP #185: Null Handling
    ... nulls, and command modifications for manipulating them. ... Tcl deals with strings, the universal medium for representing data. ... is know and it is an empty string, but if a respondent forgets to give ...
    (comp.lang.tcl)