in reply to A string parsing question
Finally that should be better.my $data = 'NCC045-071-109-SCC021-087-091-011545-'; my $state; while ($data =~ m/([A-Z]+)?(\d+)/g) { last if (length($2) == 6); $state = $1 unless (! defined $1); print $state, $2, ' '; }
|
|---|