well, probably not, as it is well documented on perlfunc
A workaround is to set the limit explicetly to undef (though, it generates a warning):
$count = () = split ' ', $_, undef;
amazingly, setting it to 0 doesn't work:
$ perl -MO=Deparse -e '$a = () = split(" ", $_, undef)' $a = () = split(" ", $_, undef); $ perl -MO=Deparse -e '$a = () = split(" ", $_, 0)' $a = () = split(" ", $_, 1);
A better workaround that doesn't generate warnings is to use a zero-but-true value:
that is parsed as:$count = () = split ' ', $_, '0e0';
$ perl -MO=Deparse -e '$a = () = split(" ", $_, "0e0")' $a = () = split(" ", $_, '0e0');
In reply to Re^4: Counting the number of items returned by split without using a named array
by salva
in thread Counting the number of items returned by split without using a named array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |