$text =~ s/(\d)(?=(\d\d\d)+(?!\d))/$1,/g; $text =~ s/(\d)((\d\d\d)+\b)/$1,$2/g; while ( $text =~ s/(\d)((\d\d\d)+\b)/$1,$2/g ) { # Nothing to do inside the body of the while -- we merely want to reapply the regex until it fails } undef $/; # Enter "file-slurp" mode. $text = <>; # Slurp up the first file given on the command line. ----------------------------------------------------------------------------- Copyright 1997-2025 Jeffrey Friedl