Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: split tosses away empty components even with positive width separators?

by Kenosis (Priest)
on May 06, 2013 at 01:32 UTC ( #1032163=note: print w/ replies, xml ) Need Help??


in reply to split tosses away empty components even with positive width separators?

Consider the following:

use strict; use warnings; my $empty = ''; my $newString = $empty . $empty . $empty . $empty;

Is $newString now comprised of four empty strings? Continuing with the above, what about the following:

my $forSplit = $newString . 'x' . $newString; my @list = split 'x', $forSplit;

Would you expect @list to now contain the following?

'','','','','','','',''


Comment on Re: split tosses away empty components even with positive width separators?
Select or Download Code
Re^2: split tosses away empty components even with positive width separators?
by wrog (Monk) on May 06, 2013 at 01:49 UTC
    Is $newString now comprised of four empty strings?
    No, because you're combining your $empty's using an empty separator, which I fully expect to be weird since you can't tell where the original boundaries were, and as I noted, is already covered in the documentation. The question is about positive-width separators...

      I'm not sure I understand the phrase "positive-width separators." An adjacency google search shows zero results for that phrase, except for your usage of it in this node and related reply.

        well, it also occurs throughout the perldoc being referenced. For "positive", try "greater than zero", or "one or more", as in "a separator having one or more characters", "x" being the separator in my case.

        Google-search may do some startling things on occasion, but it's not actually that smart...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2014-09-01 14:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (13 votes), past polls