while($number=~s/(\d)(\d{3})\b/$1\,$2/g){ # nothing here -- how silly is this? }