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/.