I'm attempting to extract numbers from codes in this generalised format (always begin with MD:Z: but what follows is variable):
MD:Z:4C3C7C0T2^T9C44Desired output (separate array elements):
4 3 7 0 2 9 44
As I need to maintain positional information and length of each number (i.e. it must be clear that 44 = 44 and not the product of something like 4T4 after screening out letters) i've tried to use split:
my @test = split((/\D/g), $input);To split on any non-number; however this returns a set of leading empty array values arising from the consecutive matches on 'MD:Z:'. Is there a way to suppress these or a better way to go about getting the desired result?
In reply to Leading empty array elements after splitting by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |