Iirc Split can return undef depending on regex capture groups | [reply] |
Split can return undef depending on regex capture groups
Yes, that's correct, for example split( /(x)|(y)/, "axbyc" ) yields ("a", "x", undef, "b", undef, "y", "c"). It's also documented at the bottom of split.
| [reply] [d/l] [select] |
Indeed, it would be incorrect for Perl to consider an uninitialized value to be an empty string, for much the same reason why, in SQL, NULL is not an empty string. | [reply] |
it would be incorrect for Perl to consider an uninitialized value to be an empty string
That is quite incorrect. Perl's undef (the default value for uninitialized scalars) evaluates to an empty string (or zero in numeric context). If warnings are enabled, this will usually warn, but only to indicate that the programmer may have made a mistake, not because it's inherently wrong.
| [reply] |
Perl does exactly that... The question isnt about arrays
| [reply] |