in reply to Applying a regular expression to a string

If $a=+1 is not the same as $a=$a+1. This is just true in case $a is undef or zero. So, you might want to say $a+=1 is the same as $a=$a+1. In any case, $a=$a+1 changes $a, so that is not what you want.

Your second code snipet is correct. You can also use

($message_id = $message)=~s/\s.*//;

Alberto Simões