Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Html - dynamic array

by GrandFather (Saint)
on Jul 24, 2009 at 08:05 UTC ( [id://782870]=note: print w/replies, xml ) Need Help??


in reply to Html - dynamic array

I don't know what you think that does, but it doesn't do it! I strongly recommend that you always use strictures (use strict; use warnings;). Under strictures the line containing ${$arr_name{$pages}}[$rws]=\@row_ele; generates the error:

Global symbol "%arr_name" requires explicit package name at ...

What you are achieving is autovivifying an entry in the package hash %arr_name. Over time your script will accumulate a hash entry for each page. If something of that sort is your intent then it would be better written using an explicit array of array (AOA):

use strict; use warnings; use HTML::TableExtract; my $te = HTML::TableExtract->new ( keep_headers => ["Customers", "Samples", "Violations", "Availabili +ty"] ); $te->parse ($final_content); my @pages; foreach my $ts ($te->tables ()) { print "Table Number(", join (',', $ts->coords), "):\n"; $rws = 0; push @pages, []; foreach $row ($ts->rows) { my @row_ele = split /,/, join ",", @$row; push @{$pages[-1]}, \@row_ele; print scalar @pages, ',', scalar @{$pages[-1]}, "\n"; } }

True laziness is hard work

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://782870]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-25 17:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found