in reply to Leading empty array elements after splitting

I'd use a global regex to extract just the digits directly into an array:

use warnings; use strict; my $string = 'MD:Z:4C3C7C0T2^T9C44'; my @nums = $string =~ /\d+/g; print "$_\n" for @nums;

Output:

4 3 7 0 2 9 44