If LIMIT is specified and positive, it represents the maximum
number of fields the EXPR will be split into, though the actual
number of fields returned depends on the number of times
PATTERN matches within EXPR. 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.
Just add at LIMIT of -1 to your split. Note: if the last ';' is a terminator instead of a separator, you will have one extra (empty) element at the end of your array:
my @arr = split /;/, $str, -1; # pop @arr; # to drop the last element
In reply to Re: Question regarding split
by sn1987a
in thread Question regarding split
by rjohn1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |