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;
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link
or How to display code and escape characters
are good places to start.