LaneM1234 has asked for the wisdom of the Perl Monks concerning the following question:
I have a code that looks through an HTML file and grabs the code between a day, (in the code, 4/23/012), and the end of that table column. The code works when I input the day manually, but if I try to make it a variable (i.e. $date), the code breaks down. If I add quotes to the day in the code, it breaks as well. I am assuming the code breaks down because of the quotes, which must be added in when I try and use a variable. Please help! I'm so close!
use strict; use LWP::Simple; print "What day?"; my $date = <>; my $url = 'http://staweb.sta.cathedral.org/departments/math/mhansen/pu +blic_html/1112hcal/1112hcal.htm'|| die "Specify URL on the cmd line"; my $html = get ($url); $html =~ m{4/23/012(.*?)<td width="3%" style='width:3.12%;border:none; +padding:0in 5.4pt 0in 5.4pt'>}gism; print "$1\n"; use Fcntl; #The Module print "content-type: text/html \n\n"; #The header sysopen (HTML, 'myhtml.html', O_RDWR|O_EXCL|O_CREAT, 0755); printf HTML "$1\n"; close (HTML);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Insert a variable without quotes
by Eliya (Vicar) on Jun 21, 2012 at 20:48 UTC | |
|
Re: Insert a variable without quotes
by davido (Cardinal) on Jun 21, 2012 at 21:59 UTC | |
|
Re: Insert a variable without quotes
by ww (Archbishop) on Jun 21, 2012 at 21:16 UTC | |
|
Re: Insert a variable without quotes
by frozenwithjoy (Priest) on Jun 21, 2012 at 20:36 UTC |