in reply to Splitting a String

The command that you are looking to use is split. The command allows you to split a string into an array based on an arbitrary pattern that you define. This command takes the format;

@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.