# Flat file
ac 193.0.0.193 Ascension Island
as 128.250.1.21 American Samoa
be 192.36.125.2 Belgium
biz 209.173.53.162 US BIZ
####
# send data to template
my @root_loop = &get_roots;
my $template = HTML::Template->new(filename => 'Digbeta/digauthform.tmpl', die_on_bad_params => 0);
$template->param(root_loop => @root_loop);
print $template->output;
####
# create Array of Hashes
sub get_roots {
my @root_loop;
open(ROOTS, "roots3");
foreach () {
chomp;
my ($code, $ip, $country) = /(.*)\t(.*)\t(.*)/;
my %roots_row = (
code => $code,
ip_addy => $ip,
country => $country
);
push(@root_loop, \%roots_row);
}
return \@root_loop;
}
####
# HTML Template