Your problem is on this line:
if { $extra_url eq *user-new* } {
The issue is that the expression parser treats the first *
of *user-new*
as a multiply operator, and you've got two binary operators in a row without a value-token in between, which is illegal syntax. Indeed, to the expression parser, you might as well have written:
$extra_url eq * user - new *
OK, that's only after tokenizing, and has other problems after the double operator, namely unrecognised barewords and a trailing binary operator; the parse will fail. (Yes, the expression parser is a pretty traditional parser, not entirely different (albeit simpler than) those used to parse C or Java or …)
I'm guessing you actually want either string equality with a literal token (put the token in {
braces}
or "
double-quotes"
) or you want to use a command to test for some more complex case, such as a glob match with string match
. Thus, pick one of these:
if { $extra_url eq {*user-new*} } {
if { $extra_url eq "*user-new*" } {
if { [string match *user-new* $extra_url] } {