Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: assigning regex matches to variables

by genghis (Novice)
on May 28, 2011 at 20:26 UTC ( [id://907165]=note: print w/replies, xml ) Need Help??


in reply to Re: assigning regex matches to variables
in thread assigning regex matches to variables

Couldn't get that to work. Also tried

my @digits = $string2 =~ /(\d)+/;

which didn't work either. I guess I'm generally confused about whether the =~ operator actually assigns the result of the search; i.e. whether

$var =~ /some_regex/;

changes the value of $var.

Replies are listed 'Best First'.
Re^3: assigning regex matches to variables
by jwkrahn (Abbot) on May 28, 2011 at 20:33 UTC

    $var =~ /some_regex/; does not change the value of $var, it just searches through $var for the pattern /some_regex/.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (9)
As of 2024-04-23 11:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found