substr($n, -($_*3 + ($_-1)*length($sep)), 0) = $sep for (1..int((length($n)-1)/3));