Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Empty strings after split /(\W)/

by Anonymous Monk
on Oct 01, 2014 at 20:44 UTC ( [id://1102587]=note: print w/replies, xml ) Need Help??


in reply to Empty strings after split /(\W)/

split does that when you put a capture group in the split expression.

$ perl -le 'print join "|", split /(\W)/, "Hello, World! ?";' Hello|,|| |World|!|| ||? $ perl -le 'print join "|", split /\W/, "Hello, World! ?";' Hello||World

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1102587]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (7)
As of 2024-04-19 20:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found