Dear All,

I am new to the PERL using XML::Twig, we need to navigate each reference element which is parent and compare both the <title> and <original_text> elements. While doing so in my xml there are multiple <title> tags present in the reference element. Thus our code produce wrong output for comparing each <title> text with <original_text> text.

I have tried the below code:
use strict;
use XML::Twig;

my @arrTitle;
my @arrOriginalText;

my $t= XML::Twig->new( twig_roots   => { 'title' => \&title_ext, 'original_text' => \&org_ext   }

  $t->parsefile( 'Test.xml');

    sub title_ext 
    { my( $t, $elt)= @_;
	push(@arrTitle, $elt->text);
      $t->purge;           # frees the memory

    sub org_ext 
    { my( $t, $elt)= @_;
	push(@arrOriginalText, $elt->text);
      $t->purge;           # frees the memory
Our Input: Test.xml
<?xml version="1.0" encoding="UTF-8"?>
<reference id="[1]">
    <book book_type="monograph">
		<person_name sequence="first" contributor_role="author">
			<given_name>L. I.</given_name>
		<organization sequence="first|additional" contributor_role="author|editor|chair|translator"></organization>
		<title>Thermodynamics and Regulation of Biological Processes</title>
      <original_text>[11] L. I. Rozonoer, <i>Thermodynamics and Regulation of Biological Processes</i>, de Gryter, Berlin, 1984.</original_text>
<reference id="[2]">
	<abbrev_title>Energie, Wirtschaftswachstum und technischer Fortschritt Phys. Bl.</abbrev_title>
      <original_text>[1] R. K&#x00FC;mmel, D. Lindenberger, W. Eichborn, Energie, Wirtschaftswachstum und technischer Fortschritt, Phys. Bl., <b>53</b>, 869 (1997).</original_text>

Is there any way to pass the argument as XPath like 'book/titles/title' and also for the instances 'Journal/titles/title'.

Kindly advise/help us on this.