Using JOIN: Converting scalar to array
I'm looping through several web pages and picking up the contents of a
particular table.
The problem is that I can't get join to give me the constituent pieces of
the scalar/array or whatever it is at that point :-) BTW, Perl is a new
language for me, so thanks for your patience.
#!/usr/bin/perl
use warnings;
use strict;
use LWP::Simple;
use DBD::mysql;
use HTML::TableExtract;
use HTML::Entities;
my $content;
my $row;
my $i;
my (@rows, @allrows);
my @people = qw(person1 person2 person3);
my ($from_month,$from_day,$from_year) = (6,26,2005);
my ($to_month,$to_day,$to_year) = (7,23,2005);
# Problem area
foreach my $person (@people) {
$content = get("http://***xx"); # from / to dates go in the real url
die "Could not download page" unless defined $content;
my $te = new HTML::TableExtract( depth => 1, count => 1 );
$te->parse($content);
@rows = $te->rows();
if (scalar(@rows) == 3) {next;}
foreach $i (1..scalar(@rows)-3) {
# Shifting contents over to put $person first
$rows[$i][2] = $rows[$i][1];
$rows[$i][1] = $rows[$i][0];
$rows[$i][0] = $person;
my $row = join(",", $rows[$i]);
^^^^^^^^^^^^^^^^^^^^^^^
# problem: how to make $rows[$i] usable...
print $row . "\n"; # expect: value1,value2,value3
}
print "Just one iteration for now!!!"; die;
}
|