Lesson 10 | Using subexpressions |
Objective | Use the s/// operator with subexpressions to perform selective text replacement. |
while ($number =~ s/(.*\d)(\d\d\d)/$1,$2/g) { }
/g
modifier is not recursive, it is necessary to put this in a loop to make sure it gets all the numbers.