Is there a way I can just download the last 20 lines from the site without having to download the whole page using perl to make for faster download time?

Not directly, but there is a way to download only the last certain number of bytes, assuming that the server on the other end supports it. Note that if the server on the other end doesn't support it, you'll just end up downloading the whole thing anyway. For example, this gets the last 500 bytes of a page:

use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $url = 'http://cpan.uwinnipeg.ca/htdocs/libwww-perl/LWP/UserAgent.h +tml'; my $response = $ua->get($url, Range => 'bytes=-500'); print $response->content;

So what I would recommend is that you get an estimate of the number of bytes in the last 20 lines, double it, and then do something like: (assuming that the doubled estimate was, say, 3500)

use LWP::UserAgent; use strict; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $url = 'http://xx.xx.xx.xx/xx.xx.xx.xx/pbsvss.htm'; my $response = $ua->get($url, Range => 'bytes=-3500'); my @lines = split(/\n/, $response->content); my @lastlines = @lines[-20 .. -1]; print "last lines: \n\n"; print @lastlines;
--
@/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/

In reply to Re: retrieve html code in reverse from remote server by fizbin
in thread retrieve html code in reverse from remote server by Peetie

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.