S
Simon Strandgaard
Maybe the return value of String#split is wrong.
If I invoke split on an empty string, then it
results in an empty Array (which I think is odd).
''.split(/\n/) #=> []
I would have expected this to happen:
''.split(/\n/) #=> [""]
For instance JavaScript has a good split.
alert("".split(/\n/).length); // -> 1
Also Python has good split.
print "".split("\n"); # -> ['']
However Perl has a bad split.
$size = split(/\n/, "");
print "size is $size"; # -> 0
If I invoke split on an empty string, then it
results in an empty Array (which I think is odd).
''.split(/\n/) #=> []
I would have expected this to happen:
''.split(/\n/) #=> [""]
For instance JavaScript has a good split.
alert("".split(/\n/).length); // -> 1
Also Python has good split.
print "".split("\n"); # -> ['']
However Perl has a bad split.
$size = split(/\n/, "");
print "size is $size"; # -> 0