Text::ParseWords

Parses lines of text and returns an array of words. Provides three functions.

old_shellwords

old_shellwords (lines) 

Splits an array of lines into words. Exported on request. Same as the pre-Perl 5 program shellwords.pl.

quotewords

quotewords (delim, keep, lines) 

Accepts delimiter and list of lines and breaks the lines into a list of words at occurrences of the delimiter. Exported by default. Takes the following arguments:

  • delim
  • Delimiter, which can be a regular expression. Occurrences inside quotes are ignored.
  • keep
  • Boolean. If false, quotes and single backslashes are removed from the list of words returned, and a double backslash is returned as a single backslash. If true, quotes and backslashes are retained.
  • lines
  • The list of lines to be parsed.
shellwords

shellwords (lines) 

Works like old_shellwords, but does not default to using $_ if there is no argument. Exported by default.