How can i pass Twig sub parameter?

Posted by aliocee on Stack Overflow See other posts from Stack Overflow or by aliocee
Published on 2010-12-25T23:24:00Z Indexed on 2010/12/26 0:54 UTC
Read the original article Hit count: 253

Filed under:

hi,

Help i cant pass my hash key to twig subroutine.

here:

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( );   

    }
}

Thanks.

© Stack Overflow or respective owner

Related posts about perl