my @nums = (); my $a = '1234567890'; while ($a =~ /(\d{1,3})/g) { push(@nums,$1); }