What do parentheses in a Perl regex do?
- by iamrohitbanga
I have been trying several regular expressions in the substitution operator:
$str =~ s/^0+(.)/$1/;
converts 0000 to 0 and 0001 to 1
$str =~ s/^0+./$1/;
converts 0000 to empty string, 000100 to 00, 0001100 to 100.
what difference is the parentheses making?