my $VarNum = "14589965321"; # or "my $xbcom =" $ins =~ s/(\d)(?=(\d{3})+(?!\d))/$1 /g; print "$VarNum\n";