in reply to Re^3: split tosses away empty components even with positive width separators?
in thread split tosses away empty components even with positive width separators?

But see the documentation pointed out by RichardK:

>perl -wMstrict -le "printf qq{'$_' } for split /-/, '-foo-bar-', -1; " '' 'foo' 'bar' ''
  • Comment on Re^4: split tosses away empty components even with positive width separators?
  • Download Code

Replies are listed 'Best First'.
Re^5: split tosses away empty components even with positive width separators?
by Laurent_R (Canon) on May 06, 2013 at 18:05 UTC

    Yeah, I had seen that point made by RichardK, but I was really referring to what is happening at the beginning of the string, which is not completely consistent. In one case you get an empty string, and in the other case you don't get it.