home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


7.2.68 Text::ParseWords - Parse Text into a List of Tokens

use Text::ParseWords;
@words = quotewords($delim, $keep, @lines);

quotewords() accepts a delimiter (which can be a regular expression) and a list of lines, and then breaks those lines up into a list of delimiter-separated words. It ignores delimiters that appear inside single or double quotes.

The $keep argument is a Boolean flag. If it is false, then quotes are removed from the list of words returned by quotewords() ; otherwise, quotes are retained.

The value of $keep also affects the interpretation of backslashes. If $keep is true, then backslashes are fully preserved in the returned list of words. Otherwise, a single backslash disappears and a double backslash is returned as a single backslash. (Be aware, however, that, regardless of the value of $keep , a single backslash occurring within quotes causes a Perl syntax error - presumably a bug.)


Previous: 7.2.67 Text::Abbrev - Create an Abbreviation Table from a List Programming Perl Next: 7.2.69 Text::Soundex - The Soundex Algorithm Described by Knuth
7.2.67 Text::Abbrev - Create an Abbreviation Table from a List Book Index 7.2.69 Text::Soundex - The Soundex Algorithm Described by Knuth