Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
go ahead... be a heretic
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
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?

In reply to Text::ParseWords by Kozz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (6)
    As of 2014-04-17 23:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (458 votes), past polls