in reply to Splitting every 3 digits?
What you want is
my @nums = $a =~ /\d{3}/g;
But with this, if the input string is not a multiple of three characters then the last one or two would be lost. If you want the l;ast element of @nums to contain one, two or three digits so that all of the digits in the input appear in @nums then use
my @nums = $a =~ /\d{1,3}/g;
|
|---|