Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Why does split on /./ not split the string?

by ChemBoy (Priest)
on Dec 07, 2005 at 18:55 UTC ( #514975=note: print w/ replies, xml ) Need Help??


in reply to Re: Why does split on /./ not split the string?
in thread Why does split on /./ not split the string?

Just to expand on this theme a bit, you can get those empty fields returned if you really want them, by passing -1 as the third argument to split: split /./,'abcde',-1 will dutifully return six empty strings. (Cases with values other than -1 are left as an exercise to the extremely bored.) Of course, there are probably faster ways to count the characters in your string, but that's a side issue. :-)



If God had meant us to fly, he would *never* have given us the railroads.
    --Michael Flanders


Comment on Re^2: Why does split on /./ not split the string?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2014-11-20 21:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (102 votes), past polls