Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Applying a regular expression to a string

by ambs (Pilgrim)
on Apr 04, 2005 at 11:42 UTC ( #444628=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://444628]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2020-04-06 03:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The most amusing oxymoron is:
















    Results (36 votes). Check out past polls.

    Notices?