Ende asked...

Why?

$a = "1  2 3";
        1  2 3
split / /, $a;
        [1, "", 2, 3]
split " ", $a;
        [1, 2, 3]

Using a single space as the string on which to split triggers a special case: from "perldoc -f split"

               specifying a PATTERN of space (' ') will
split on white space just as "split" with no arguments does.

Cheers,
Paul

Reply via email to