Forum Discussion

AndyC_86542's avatar
AndyC_86542
Icon for Nimbostratus rankNimbostratus
Oct 10, 2008

Syntax help needed (very basic)

I want to assign the result of a comparison to a local variable. I keep getting "Invalid command name". This is the minimum code to show the problem:

 

 

 
 set param "wibble" 
 set result [[HTTP::uri] contains $param] 
 

 

 

Any ideas what I am missing.

2 Replies

  • Hi there,

     

     

    The []'s execute the code within. They're like backticks (`) in *nix. You can use 'expr' (Click here) or 'if' instead:

     

     

    set result [expr {[HTTP::uri] contains $param}]

     

     

    or

     

     

     
     if {[HTTP::uri] contains $param}{ 
        set result 1 
     } else { 
        set result 0 
     } 
     

     

     

    Aaron