Forum Discussion
dlg_23340
Nov 18, 2011Cirrus
variables in a switch statement
What are my options for variable expansion in switch cases? It seems to me that in the following code, when i visit http://example.com/bar/test, I should get "you found foo." for my page content. In...
dlg_23340
Nov 18, 2011Cirrus
Thanks, Nitass. I'm using your first example because I prefer its structure... But I'm running into a problem. I have code like this:
set foo "bar"
switch -glob -- [URI::decode [HTTP::uri]] "
/$foo/* { HTTP::respond 200 content {you found foo.} }
default {
set x {hello}
log local0. {$x}
}
"
Executing this results in "TCL error: testirule - can't read "x": no such variable. Any idea why?
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects