DZ-Jay wrote:

Hello:
I have a problem using the split() function: When there are trailing delimiters, without any content between them, split() skips them. For example, this:

    my @foo = split(/,/, 'this,is,a,test,,');

yields:
    this
    is
    a
    test

while I'm expecting:
    this
    is
    a
    test
    ''
    ''


my @foo = split(/,/, 'this,is,a,test,,',-1);
The trailing integer controls the maximum number of values split will return. If not specified then trailing empty fields are omitted. If negative then all fields (including trailing empty ones) are returned.

jps


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to