per the advice given to me, i added $ua = LWP::UserAgent->new; after my variable declaration. The fixed the previous error (thanks so much)However, now my problem lies within my regex. Here's the updated code:
#!/usr/bin/perl use HTTP::Request; use HTTP::Headers; use LWP::UserAgent; my(@ListingsUrls, $req, $ua, $responsecode, $res, $row, $url); $ua = LWP::UserAgent->new; $url = "http://listings.test.com/aw/listings/list/category12"; $request = new HTTP::Request('GET',$url); $ua->timeout(10); $response = $ua->request($request); my $responsecode = $response->code(); next if $responsecode != 200; @ARRAY_OF_LINES = (split "\n", $ua->request($request)->as_stri +ng); $request->as_string; foreach $row (@ARRAY_OF_LINES) { chomp($row); print $row . "\n"; } if ($row =~ (/Updated\s*:\s*\w+\s*-\s*\d{1,2}:\d{1,2}\d{1,2}\s +* PST/)){ print $1; }else{ print "html didn't contain Updated"; }
I added a print statement to $row and i can see what i am looking for(this is an excerpt from my console when the line print $row is executed):
<tr> <td> <p></p><br> <center> <font face="Arial, Helvetica" size="-1"> <b>Updated: Mar-11 23:05:50 PST</b>
Any advice would be greatly appreciated.
thnx, Ray

In reply to Re: my code error-ing out trying to grab html by RayRay459
in thread my code error-ing out trying to grab html by RayRay459

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.