If you don't want to clobber the $testString contents
Both:
my $l_count = $testString =~ tr/(//; my $r_count = $testString =~ tr/)//;
and:
my $l_count = ($testString =~ tr/(/(/); my $r_count = ($testString =~ tr/)/)/);
do exactly the same thing. Neither of which "clobbers" the string.
not sure if that is returning in a list context
The left-hand side of the assignment determines context, in this case scalar, so the parentheses are irrelevant.
In reply to Re^3: IT's not counting...
by jwkrahn
in thread IT's not counting...
by Dwood
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |