Sean M. Burke wrote:
> 
> The current behavior makes trailing empty fields non-existent, and that's a
> bizarre and nonintuitive thing to have be a default;

Only to some people; and besides, it's well documented.


> if your code relies on
> them being removed, then remove them explicitly, without expecting split to
> do it for you /by default/ at the expense of all the people who would
> expect a saner and less surprising default.
> If you want trailing/leading/all nulls removed without having to type the
> single line of code it'd take to do it explicitly, then have that be an
> option to split; don't have it be a default.

I think it's an entirely fine default.  If you want your "sane" behavior,
you have to do nothing more than

        split /\s+/;

But if the default were changed as you suggest, then to get the
current (exremely useful) behavior, one has to do

        @a = split /\s+/; # non-magical now, thanks.  :-(
        pop   @a if @a && $a[-1] eq '';
        shift @a if @a && $a[ 0] eq '';

I think the choice is obvious.

-- 
John Porter

        By pressing down a special key  It plays a little melody

Reply via email to