my $number_of_digits = $test_string =~ tr/0-9/0-9/;
tr/_in_/_out_/ does a translation of characters and counts the number of translations it made. In this case, it swaps each number with itself (not changing the original string), but counts how many numbers it translated.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.