Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Leading empty array elements after splitting

by TomDLux (Vicar)
on Aug 23, 2016 at 16:01 UTC ( [id://1170233] : note . print w/replies, xml ) Need Help??


in reply to Leading empty array elements after splitting

Extracting just the numbers works well, but since you describe a problem with getting blank stuff you don't want, you might as well know about grep ...

22 11:56:12 tomdlux [ ~ ] $ p522 -E 'say for split /\D+/, "MD:Z:4C3C7C0T2^T9C44"' + 4 3 7 0 2 9 44 23 11:56:19 tomdlux [ ~ ] $ p522 -E 'say for grep {length $_} split /\D+/, "MD:Z:4C3C7C0T2^T9C44 +"' 4 3 7 0 2 9 44

As Occam said: Entia non sunt multiplicanda praeter necessitatem.