Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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?

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

Replies are listed 'Best First'.
Re^2: split tosses away empty components even with positive width separators?
by wrog (Friar) 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 imbibing at the Monastery: (7)
As of 2016-10-01 21:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (8 votes). Check out past polls.