I haven't done much with real parsing beyond simple regexen, but I believe what you really want to do is break the line into tokens:

my $to_parse = q(my $thisRocks = " That's what I said!";); my @tokens = get_tokens($to_parse); # The elements in @tokens will look something like: # # 0: my # 1: $thisRocks # 2: = # 3: " That's what I said!" # 4: ; # # Now you can just print them out print @tokens; __OUTPUT__ my$thisRocks=" That's what I said!";

Of course, I'm leaving out the implementation of get_tokens() (as you can see above, it would take in a string to parse and returns a list with each token in a single element). This is the part that goes beyond my experiance, so I'm leaving implementation of that alone. Hopefully, this will be enough for you to dig up the rest of the information. I do know that relevent code for how perl breaks it up is the the perl source code in toke.c.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

Note: All code is untested, unless otherwise stated


In reply to Re: Remove Tabs and white space from a line except in Quotes by hardburn
in thread Remove Tabs and white space from a line except in Quotes by SmokeyB

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.