Here's a snippit of the web page I've parsed:
<br> <span class="smalltype"><em>Date:</em></span> Tue&nbsp;Sep&nbsp;13,&nbsp;2005&nbsp; 10:38 pm <br> <span class="smalltype"><em>Subject:</em></span>
Using TokeParser, I've managed to assign the following to $GetDate:
Tue&nbsp;Sep&nbsp;13,&nbsp;2005&nbsp; 10:38 pm
Probably as a function of the module, I'm assuming it's compiling the HTML so that when I print back the contents, it comes out as:
Tue Sep 13, 2005 10:38 pm
Now because I want to split this guy up and create a timestamp from it, I figure the best plan is to assign it to an array with the following statement:
my @date = split /\s+/, "$GetDate";
And here's the contents of the array:
0 1 Tue Sep 13, 2005  2 10:38 3 pm 4
Obviously, the nonbreakable spaces (&nbsp;) are preventing me from getting the rest of it split apart. What do I do to clear this up?

I know there's some time modules out there, but I was just going to try this operation manually as I have the impression that's the best way to keep the speed up on an already deathly slow script. Is this a good plan, or am I just making more work for myself?

Thanks!


In reply to Array problem when parsing HTML by SpacemanSpiff

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.