split
# given 'name, age, dob, email'
$string->split(', '); # ['name', 'age', 'dob', 'email']
$string->split(', ', 2); # ['name', 'age, dob, email']
$string->split(qr/\,\s*/); # ['name', 'age', 'dob', 'email']
$string->split(qr/\,\s*/, 2); # ['name', 'age, dob, email']
The split method splits the string into a list of strings, separating each chunk by the argument (string or regexp object), and returns that list as an array reference. This method optionally takes a second argument which would be the limit (number of matches to capture). Note, this operation expects the 1st argument to be a Regexp object or a String. This method returns a array object.
split(RegexpRef $arg1, Num $arg2) : ArrayObject
method
5 POD Errors
The following errors were encountered while parsing the POD:
- Around line 10:
Unknown directive: =name
- Around line 14:
Unknown directive: =usage
- Around line 23:
Unknown directive: =description
- Around line 32:
Unknown directive: =signature
- Around line 36:
Unknown directive: =type