in reply to Mystery interaction between split and gobbling arrays
The output you want can be obtained with a -1 LIMIT:If LIMIT is omitted (or, equivalently, zero), then it is usually treat +ed as if it were instead negative but with the exception that trailin +g empty fields are stripped (empty leading fields are always preserve +d);
perl -MData::Dumper -e "$str='foo:bar:'; ($x,@opt)=split /:/,$str,-1;p +rint Dumper ($x,\@opt)" $VAR1 = 'foo'; $VAR2 = [ 'bar', '' ];
|
|---|