Forum Discussion

Deb_Allen_18's avatar
Deb_Allen_18
Historic F5 Account
May 22, 2005

use of {} as text delimiter

 

Here's a case where I've used {} as a delimiter. It seems to work, but I was wondering if it was legal usage of {}s and whether there was a better way:

 

 

HTTP::redirect "http://host.dom.com/sub/index.jsp?id=a0a0a&pid=${in_pid}&ptype=list"

 

 

The variable is followed directly by additional text with no natural delimiter, so I wanted to delimit the variable name, but double quotes around the variable would terminate the redirect string prematurely.

 

 

(Actually as it turns out, the character trailing the variable name is a &, which seems to delimit the name naturally. If an alpha-numeric follows the variable name, I get an undefined variable error. I can't find a documentation reference on that, so it seemed safest to delimit it somehow. I should at least know the proper way to do so.... =+)

 

 

thanks again for the great info

 

 

/deb

 

  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Yes, Tcl allows the use of braces {} as a variable name delimiter. As a matter of fact, if your variable name contains any non-alphanumeric characters (other than an underscore), you will have to use braces around the variable name.

    For example, you can use a hyphen in your variable name as in:

     
     set my-really-cool-name "Pooh Bear"  
     log "My name is: ${my-really-cool-name}" 
     

    However, the use of the hyphen will require the use of braces on all the variable references.