Hi,
I have a string variable which I have done some pattern matching on and I want to assign the matched text to a new variable.
I have this:
$new_variable = $the_string =~ m/^\s*\w+/;
However, when the pattern is found this assigns 1 (true) to the new_variable rather than the string itself. How can i get it to assign the string?
Cheers
I have a string variable which I have done some pattern matching on and I want to assign the matched text to a new variable.
I have this:
$new_variable = $the_string =~ m/^\s*\w+/;
However, when the pattern is found this assigns 1 (true) to the new_variable rather than the string itself. How can i get it to assign the string?
Cheers