I would suggest you use the html source and use HTML::TokeParser to parse it out. The following might be a good place to start. (I saved the html source into the file "APMA.txt")

#!/usr/bin/perl use HTML::TokeParser; use strict vars; my $file = 'APMA.txt'; my $stream = HTML::TokeParser->new($file); my $tok; while( $tok = $stream->get_token) { if( $tok->[1] eq 'a' && $tok->[2]{'href'} =~ m/course_nbr/ ) { print "Class: " . $stream->get_text('/a') . " "; } if( $tok->[1] eq 'span' && exists($tok->[2]{'class'}) && $tok->[2] +{'class'} eq "title") { print $stream->get_text('/span') . "\n"; } if( $tok->[1] eq 'span' && exists($tok->[2]{'title'}) && !exists($ +tok->[2]{'class'}) ) { print "Title = $tok->[2]{'title'}: "; print $stream->get_text('/span'), "\n"; } } exit;
partial output:

Class: APMA 109 Calculus I Title = Schedule Number: 92861 Title = Section Number: 0001 Title = Credit Hours: 04.0 Title = Time: 0900-0950 Title = Day:MTWRFS: MWF Title = Olsson Hall: OLS 011 Title = Instructor: Oberhauser, James P. Title = Enrollment:Authorized/Actual: 55/2 Title = Grading Method: O Title = Time: 0830-0920 Title = Day:MTWRFS: T Title = Olsson Hall: OLS 005 Title = Instructor: Title = Schedule Number: 90063 Title = Section Number: 0002 Title = Credit Hours: 04.0 Title = Time: 1000-1050 Title = Day:MTWRFS: MWF Title = Olsson Hall: OLS 120 Title = Instructor: Beck, Mary Title = Enrollment:Authorized/Actual: 55/4 Title = Grading Method: O Title = Time: 0830-0920 Title = Day:MTWRFS: R Title = Olsson Hall: OLS 120 Title = Instructor: ... Class: APMA 111 Single Variable Calculus Title = Schedule Number: 93433 Title = Section Number: 0001 Title = Credit Hours: 04.0 Title = Time: 1100-1150 Title = Day:MTWRFS: MWF Title = Olsson Hall: OLS 011 Title = Instructor: Title = Enrollment:Authorized/Actual: 55/55 Title = Grading Method: O Title = Time: 0830-0920 Title = Day:MTWRFS: T Title = Instructor: Castiglione, Jason ...
Further parsing is easily done to get exactly what you want.
Take a look at Perl & LWP for more information.

Hope this helps,
davidj

In reply to Re: Parsing COD text help by davidj
in thread Parsing COD text help by dimmesdale

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.