I wrote the following script to extract some information from a web page and print it to the screen. The web page is absolutly basic HTML so my paltry regexp works fine.
The problem is in the print statements at the end wherein I attempt to print out the information I extracted. As shown below, the script only prints out the contents of $avg_size. If I uncomment all but any of the variables, it prints out correctly.
I have tried forcing the screen to autoflush using the STDOUT->autoflush(1) method of the FileHandle module and by setting $| = 1. Neither option had any effect.
#### retrieve web page
my $url = "http://www.visionforum.com/admin/avantgo.asp";
my $page_content = get($url);
#### remove extraneous information and HTML markup
(my $plain_text = $page_content) =~ s/<[^>]*>//gs;
#### extract relevant info
my @lines = split /\n/, $plain_text;
my $title = $lines;
my $timestamp = $lines;
my $shoppers = $lines;
my $num_orders = $lines;
my $gross_sales = $lines;
my $avg_size= $lines;
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- 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
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||