Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: How to split a string based on character(s) length

by Anonymous Monk
on Aug 13, 2014 at 16:36 UTC ( [id://1097314]=note: print w/replies, xml ) Need Help??


in reply to How to split a string based on the length of a sequence of characters within the string

See the documentation of split: if you include a capture group in the regular expression, split will include the separator in its output.

$ perl -wMstrict -le 'print join ",", split /[a-z]/, "1a2b3c4"' 1,2,3,4 $ perl -wMstrict -le 'print join ",", split /([a-z])/, "1a2b3c4"' 1,a,2,b,3,c,4

Replies are listed 'Best First'.
Re^2: How to split a string based on character(s) length
by thanos1983 (Parson) on Aug 13, 2014 at 20:35 UTC

    Hello Anonymous Monk,

    Hmmm I guess I have to read closer the split, I missed this part. Thank your time and for pointing to the correct direction.

    Seeking for Perl wisdom...on the process of learning...not there...yet!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-19 04:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found