Your second code snipet is correct. You can also use
($message_id = $message)=~s/\s.*//;
Alberto Simões
In reply to Re: Applying a regular expression to a string
by ambs
in thread Applying a regular expression to a string
by mw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |