帮助我无法将哈希键传递给树枝子例程。
这里:
foreach my $word (sort { $keywords{$a} <=> $keywords{$b} } keys (%keywords)) {
my $t = XML::Twig->new( twig_roots => { 'Id' => \&insert($keywords{$word}) } );
$t->parse($docsums);
sub insert
{
my($t, $id, $k)= @_;
my $p = $id->text;
my $query = "insert into pres (id, wid, p) values(DEFAULT, '$k', '$p')";
my $sql = $connect->prepare($query);
$sql->execute( );
}
}
谢谢。