chomp your input. The trailing newline is giving you the problems you're attributing to quotes.
Line 7 probably takes a much bigger bite than you need. The td and style attributes have nothing to do with your assignment. But, OTOH, you might like to say:
$html =~ m{$date(.*?)(?=</tr>)}gms;
to make sure you get the whole mess.
Did /me just call that assignment page a mess? Yep! It appears that the maker is using MS Word (or possibly, some other M$, gefuksperated generator of HTML) producing excessively verbose, unnecessarily obscure code. You have my sympathy, because the best you'll get directly from this site is something like this:
977707.pl
What day? 4/24/012
Wide character in print at D:\_Perl_\pl_test\977707.pl line 14, <> lin
+e 1.
<o:p></o:p></span></p>
</td>
<td width="85%" valign=top style='width:85.66%;border:none;backgroun
+d:white;
padding:.75pt .75pt .75pt .75pt'>
<p class=MsoNormal style='tab-stops:decimal .5in left 109.85pt'><b
style='mso-bidi-font-weight:normal'><span style='font-size:10.0pt'>A
+P Exam-<span
class=SpellE>ish</span> Test, Part IA (multiple <span class=GramE>ch
+oice</span>,
no calculator).</span></b><span style='font-size:10.0pt'> We will st
+art at
7:55 sharp: 28 questions in 55 minutes.<br>
<br>
HW due (will not be collected until next week): another 70 minutes&#
+915;اض worth of
AP review problems, double dose over the long weekend.<o:p></o:p></s
+pan></p>
</td>
<td width="3%" style='width:3.12%;border:none;padding:0in 5.4pt 0in
+5.4pt'>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p><
+/span></p>
</td>
Dealing with the encoding that produces the initial "wide character" report would be trivial, but getting rid of the proprietary tags and css will be a major PITA.
FTR, the following code produced the above output but it still has problems -- such as the omission of a line to IMMEDIATELY assign the value in $1 to a named $var and the uninformative and misleading message in your or die:
#!/usr/bin/perl
use 5.014;
use LWP::Simple;
print "What day? ";
my $date = <>;
chomp $date;
my $url = 'http://staweb.sta.cathedral.org/departments/math/mhansen/pu
+blic_html/1112hcal/1112hcal.htm'|| die "Specify URL in the form 'm/dd
+/0yy'";
my $html = get ($url);
$html =~ m{$date(.*?)(?=</tr>)}gms;
print "$1 \n";
And BTW, this smells even more like homework, now, given the assignment date is nearly 2 months past.
|