http://qs321.pair.com?node_id=117147

Kozz has asked for the wisdom of the Perl Monks concerning the following question:

I have a question regarding the Text::ParseWords module, which is standard with the latest versions of Perl. I've studied the perlman page on this module, but am still confused why it seems to "break" in my test-case. Here's what I wanted to do:
use Text::ParseWords; my $heredoc =<<END_OF_HEREDOC; The Text::ParseWords module is the most recent module with which I've struggled. END_OF_HEREDOC my @words = quotewords('\s+', 0, $heredoc); foreach(@words){ print $_ . "\n"; }
The problem seems to be that it outputs NOTHING ; no words at all. And the root of the problem lies in the single apostrophe in the string which is part of a conjuction. But if I escape the single-quote by putting a backslash in front of it, then everything is output fine. I could use a regex to place backslashes in front of apostrophes, but are these the only characters that cause this problem? Am I not quite using this module correctly? It seems silly to have to escape the characters -- why won't it just work?