Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
As grep says, you are printing everything, but there are no newlines in any of those variables since split removes them. The output variables overwrite each other because each ends in a carriage return character (this can often be seen in the output as the one line you do get sometimes has garbage at the end left over from previous lines). One solution which builds on grep's and adds a somewhat simpler print statement follows:
my @lines = map{"$_\n"} split /\r\n/, $plain_text; print @lines[10,11,13,17,18,20];
If you want to keep the meanings of the various line numbers intact in the code, but avoid creating independent variables for that purpose, you could do something like the following:
use strict; use LWP::Simple; my %info_lines = ( title => 10, timestamp => 11, shoppers => 13, num_orders => 17, gross_sales => 18, avg_size => 20, ); my $url = "http://www.visionforum.com/admin/avantgo.asp"; my $page_content = get($url); (my $plain_text = $page_content) =~ s/<[^>]*>//gs; my @lines = map{"$_\n"} split /\r\n/, $plain_text; print $lines[$_] for sort values %info_lines;

--
I'd like to be able to assign to an luser


In reply to Re: Screen buffering mystery by Albannach
in thread Screen buffering mystery by mvaline

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (6)
    As of 2020-02-18 09:25 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      What numbers are you going to focus on primarily in 2020?










      Results (75 votes). Check out past polls.

      Notices?