That's because you're using the wrong operator; the '=' operator is used for assignment, e.g. changing the value of a variable.
What you need is the logical operator '==' that allows you to compare two things. See this page for more information about the different operators: [man]language.operators[/man].
EDIT: D'oh, laserlight and I posted at the same time :p