This sounds like it may be more of a UBB mod question than a Perl question, so maybe posting it in the mod questions forum would get a more accurate response.
If an 'if' doesn't appear to be having an effect, the way to troubleshoot it is to add 'print' or 'warn' statements around the problem area to see exactly what the variables are getting set to.
Another possibility is that your code isn't located in the right place in the script, so the change you're making isn't getting saved.
If it's really $user_profile[20] that needs to be updated, perhaps you meant to do this: