in reply to Re: I am now slice-aware
in thread I am now slice-aware

Or, as tye enlightened me earlier, you can always use -1 if you have no idea about the number of entries you want, as -1 prevents split from discarding trailing empty fields:      $newentry = join(":", split(/:/, $_, -1));

Replies are listed 'Best First'.
Re: Re^2: I am now slice-aware
by davorg (Chancellor) on Apr 17, 2001 at 19:19 UTC

    Any negative number would do. From perldoc -f split:

    "If LIMIT is specified and positive, splits into no more than that many fields (though it may split into fewer). If LIMIT is unspecified or zero, trailing null fields are stripped (which potential users of pop() would do well to remember). If LIMIT is negative, it is treated as if an arbitrarily large LIMIT had been specified."

    --
    <http://www.dave.org.uk>

    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me