use warnings; use strict; my @numb3rs = qw/1024 16777215 3,1415926 42 759092417205229390873,8763617/; for my $num ( @numb3rs ) { print "number: $num\n"; my $regexed = $num; $regexed =~ s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1./g; print "perlfaq: $regexed\n"; $regexed = $num; $regexed =~ s/(\d+)(\d{3})/$1.$2/; print "strat: $regexed\n"; $regexed = $num; $regexed =~ s/(\d\d\d)(?=\d)(?!\d*,)/$1./g; print "crian: $regexed\n"; } continue { print '=' x 75, "\n" }