split

Synopsis

@ split('pattern', "string", [limit])

splits the specified string by the specified pattern

Parameters

"string" - the string to split

'pattern' - the pattern that defines substrings this string should be broken up by.

limit - limits the number of segments to split the sentence into.

Returns

a scalar array

Examples

@data = @("Raphael,Professional Escort,NY", "Frances,Sales Warrior,MI"); foreach $var (@data) { ($name, $job, $state) = split(',', $var); println("$name works as a $job in $state"); }

Raphael works as a Professional Escort in NY Frances works as a Sales Warrior in MI

See Also