All,
I have a question pertaining to traversing up/down lines once you've matched your $string.
You can find the scenario I'm dealing at this URL:
http://soc.our.psu.edu/soc/fall/up/i-o/ist.html
Basically -- I wrote a script to track classes I need to register. It does the whole bit -- emails me when a slot opens, etc. I'm using the schedule number as my matching $string. So $string gets me to the line that holds all of the info for the particuliar class. The only info I cannot get from that line is the actual name of the class.
Example:
$string = "335794";
$_ = /$string/;
This would get me the line of the output which has 335794. Then from there I can do regex to parse out all of the data, such as remaining seats.
My question is how would I then traverse up x number of lines to get the class name, being "IST 230" in this scenario. The number x will not be a set number seeing as each class has a different number of sections available.
Background Info:
I'm using w3m -dump $url to get the output of the page. The -dump option just spits out what the page actually looks like -- it does NOT output the HTML source.
Thank you anyone who can help me out with this.
- Justin
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.