###########################
# s.pl
# 07.10.17
# 07.12.05
use strict;
use HTML::Template;
my(%t,@fld,$n,$template,@loop);
print "Please input filename=";
chop($t{root}=<STDIN>);
$t{tmpl} = $t{root} . '0.htm';
$t{inputf} = $t{root} . '.txt';
$template = HTML::Template->new(filename => $t{tmpl});
@loop = ();
$t{htmfile} = $t{root} . '1.htm';
$t{flag} = 1;
open(IN,"$t{inputf}") or die "Can't open the file $t{inputf}";
while(<IN>){
next if $. == 1;
next if length($_) < 2;
if ( $t{flag} == 1 ) {
$t{flag} = 2;
push(@{ $t{N1s} },$_);
$t{N11} = $_;
} elsif ($t{flag} == 2) {
$t{clist}{$t{N11}} = $_;
$t{flag} = 3;
} elsif ($t{flag} == 3) {
$t{elist}{$t{N11}} = $_;
$t{flag} = 1;
}
}
close(IN);
@{ $t{NN} } = sort @{ $t{N1s} };
#@{ $t{NN} } = @{ $t{N1s} };
for $n ( 0 .. $#{ $t{NN} } ) {
$t{N1} = $t{NN}[$n];
$t{c1} = $t{clist}{$t{N1}};
$t{e1} = $t{elist}{$t{N1}};
my %row = (
N1 => $t{N1},
C1 => $t{c1},
E1 => $t{e1}
);
push(@loop, \%row);
}
$template->param(std_loop => \@loop);
open(OUT,">$t{htmfile}");
print OUT $template->output;
close(OUT);
print "The output file is $t{htmfile}\n";
__END__;
汝城县|
林甸县|
客服|
靖江市|
开化县|
铜山县|
饶阳县|
鄂托克旗|
龙口市|
易门县|
无棣县|
洛宁县|
石阡县|
吐鲁番市|
安庆市|
阳城县|
济源市|
报价|
长武县|
栾川县|
镇原县|
通州市|
陵川县|
萍乡市|
康保县|
元朗区|
阿坝|
沙坪坝区|
曲沃县|
清新县|
额尔古纳市|
顺义区|
岗巴县|
阿拉善左旗|
贵港市|
栾城县|
凤台县|
林口县|
靖安县|
中方县|
民丰县|