switch -glob behaviour when comparison string starts with a hyphen

I’m attempting to use this iRule… DevCentral - An F5 Technical Community

However, when the server sends “Set-Cookie=SOMETHING=-1” I get the error… bad option “-1”: must be -exact, -glob, -regexp, or -- while executing “switch -glob “${testvalue}” { “;secure” - “; secure” { } default { set value “$value; Secure”; } }” (“foreach” body line 8) invoked from within “foreach cookie [HTTP::cookie names] { if { [HTTP::cookie path $cookie] != “/” } { set value [HTTP::cookie value $cookie]; if { “” != $…”

How do I tell “switch” not to interpret the sting “-1” as an option? As you can see in the error message, I’ve tried enclosing it in quotes.

I can’t reproduce this behaviour using tclsh. Is this a bug?

Have you by chance tried the “--” option?

switch -glob -- $testvalue {
    ...
}

Reference: http://www.tcl.tk/man/tcl8.4/TclCmd/switch.htmM8