in reply to Splitting a String
@result = split (/PATTERN/, EXPR, LIMIT)
If EXPR is omitted, this command splits the contents of the $_ string. If the PATTERN argument is also omitted, this command will split on whitespace (after skipping any leading whitespace). Anything matching pattern (in this case, you would want to use '|') is taken as the delimiter between fields.
The LIMIT argument allows you to split EXPR into no more than LIMIT fields. This is very useful if you only need to extract a certain number of fields from EXPR.
You can compare this command to the join statement.
|
---|