Here's something that was lingering in my mind for sometime. I use dynamically named
arrays a lot. I find using them much better when i'm not sure about the quantity of data i have
For example:
$te = HTML::TableExtract->new(keep_headers=> ["Customers","Samples","V
+iolations","Availability"]);
$te->parse($final_content);
$arr_name = "ARR";
my $pages=0;
foreach $ts ($te->tables)
{
print "Table Number(" , join(',',$ts->coords), "):\n";
$rws=0;
foreach $row ($ts->rows)
{
$temp = join (",",@$row);
my @row_ele = split(/,/,$temp);
print "$pages,$rws\n";
${$arr_name{$pages}}[$rws]=\@row_ele;
# print ${$arr_name{$pages}}[$rws]->[1]."\n";
$rws++;
}
$pages++;
}
Here the $final_content is html data with some tables.
Though this code works absolutely fine and with no errors, i still wonder if I should
use something else other than dynamically named arrays.
I use them in almost anything that deals with threads/html or with data for
which i'm not sure about the quantity...Just curious!
-
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>
<u> <ul>
-
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
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.