Why?
$a = "1 2 3";
1 2 3
split / /, $a;
[1, "", 2, 3]
split " ", $a;
[1, 2, 3]
--
Juan Falgueras
Profesor del Depto. de Lenguajes y Ciencias de la Computación
Universidad de Málaga
Paul McCann - 18 Jul 2006 23:37 GMT
Ende asked...
> Why?
>
[quoted text clipped - 4 lines]
> 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
David Cantrell - 19 Jul 2006 12:56 GMT
On Wed, Jul 19, 2006 at 12:29:04AM +0200, ende wrote:
> Why?
>
[quoted text clipped - 4 lines]
> split " ", $a;
> [1, 2, 3]
Splitting on / / is different from splitting on " " because " " is
magickal. While this is mentioned in the docs for split(), it could
perhaps be written somewhat better.

Signature
David Cantrell | Enforcer, South London Linguistic Massive
Are you feeling bored? depressed? slowed down? Evil Scientists may
be manipulating the speed of light in your vicinity. Buy our patented
instructional video to find out how, and maybe YOU can stop THEM