in reply to Leading empty array elements after splitting
If you use warnings, you’ll see that the /g modifier on the regex has no effect within a split. But why not keep the modifier, change \D to \d+, and dispense with split altogether?
1:22 >perl -MData::Dump -wE "my $input = 'MD:Z:4C3C7C0T2^T9C44'; my @ +test = $input =~ /\d+/g; dd \@test;" [4, 3, 7, 0, 2, 9, 44] 1:22 >
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Leading empty array elements after splitting
by Anonymous Monk on Aug 22, 2016 at 16:20 UTC | |
by stevieb (Canon) on Aug 22, 2016 at 16:29 UTC | |
by Anonymous Monk on Aug 22, 2016 at 16:32 UTC | |
by stevieb (Canon) on Aug 22, 2016 at 17:00 UTC | |
by Anonymous Monk on Aug 22, 2016 at 17:34 UTC |