in reply to Splitting every 3 digits?

Split will return the text between each match, and if the pattern contains parens, as yours does, it will also return the contents of the parens. So you code will return a list where every other element is a group of three digits and the other element will be empty strings. Except at the end, if the input string is not a multiple of three charaters, then you will see something different.

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;