I am a high school student (and a perl newbie) and I want to write a program to download my grades from the sites where they are posted. My goal is to print the overall grade. This is what I have so far (for history):
#!/usr/bin/perl -w
use LWP::Simple;
use HTML::Obliterate qw(extirpate_html);
$url="where my grades are.html";
$mypage=get($url);
my $q=extirpate_html( $mypage );
open OUT, ">/home/jesse/Desktop/grades/history.txt";
select OUT;
print $q;
close OUT;
open(GRADE, "/home/jesse/Desktop/grades/history.txt");
$. = 0;
do { $history = <GRADE> } until $. == 32 || eof; #32 is the line with
+ my grade
print $history
close(GRADE);
This actually works fairly well for english, but when I try it with my history grade it doesn't work at all. If I open history.txt, it shows all the information from the web page. Yet with a simple test in perl...
#!/usr/bin/perl -w
use LWP::Simple;
use HTML::Obliterate qw(extirpate_html);
$url="where my grades are.html";
$mypage=get($url);
my $y=extirpate_html( $mypage );
print $y;
...I see that only a garbled bit of the information is really saved as $y. How can I read the whole thing if only part is saved? Is this information not really there?
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.