You don't say what value you are reading in, or why you feel that you got the wrong result. Also, have you tried printing the value of $name before the if to verify that you are getting the param right? (which is the more likely problem).
As always, are you using strict?
-pete
"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."