Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Reg ex question

by jeroenes (Priest)
on May 18, 2001 at 17:52 UTC ( [id://81502]=note: print w/replies, xml ) Need Help??


in reply to Reg ex question

Generally:
$variable =~ m/;=(\d+);/ print $1; #holds 99 now.
So everything between parens gets assigned to variables with a number as the name. They stay available until the next match or substitution. You can read all about it in perlop and perlre.

Hope this helps,

Jeroen
"We are not alone"(FZ)
Update: chromatic pointed out to me that it would be good to make the remark that $1 is only set when the string matches. I totally agree with him.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-25 15:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found