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);

In reply to Insert a variable without quotes by LaneM1234

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.