XML::Twig->new( twig_roots => { 'div' => sub{ &div(@_,$para); }, } )->parsefile("my_file");