in reply to assigning regex matches to variables
when I try to pull out 81 from the string A81, it doesn't do what I expected
my $digits = $string2 =~ /(\d)+/;
The modifier + is outside the parentheses so it will only match a single \d character multiple times. To match multiple \d characters the modifier has to be applied directly to the pattern: /(\d+)/.
|
|---|