in reply to 1 while s/// vs s///g

I first encountered this while looking for a quick way to "commify" a string.     1 while s/(\d)(\d\d\d)(?=$|\.|,)/$1,$2/; Works quite well for integers and currency, though it fails in a "D'oh!" way if you feed it a string that has more than three digits after a decimal point.