Thanks for your quick reply, sorry for lack of information. I have added the full code below. I am trying to get the values of author into an array. Unfortuantely my @array = map{$_->textContent} $authors->findnodes('./authors/author'); does not do this. Hopefuly this makes more sense
use CGI qw(-utf-8 :all *table);
use LWP::Simple qw(get);
use URI;
use XML::LibXML;
use Data::Dumper;
use utf8;
binmode(STDOUT, ":encoding(utf-8)");
my $parser = XML::LibXML->new();
$author = param('query');
$maxHits = param('maxHits');
my $url = URI->new("http://www.dblp.org/search/api/?");
my($q,$h,$c,$f,$format) = ($author,$maxHits,"4","0","xml");
$url->query_form(
'q' => $q,
'h' => $h,
'c' => $c,
'f' => $f,
'format' => $format,
);
print header(-charset=>'utf-8'), "\n",
start_html({-title=>'DBLP Search',
-author=>'<>'}), "\n";
if (param('submit')) {
my $xml= get($url);
my $doc = $parser->parse_string( $xml);
print h1("Authors"), "\n";
foreach my $authors ($doc->findnodes('/result/hits/hit/info'))
{
print $_->textContent, "\n" for $authors->findnodes('./authors
+/author');
my @array = map{$_->textContent} $authors->findnodes('./author
+s/author');
}
}
print h1("DBLP Query"), "\n";
print start_form({-method=>"POST"
-action=>"http://cgi.csc.liv.ac.uk/cgi-bin/cgiwrap/u6ed/stat.pl"})
+;
print label("query: ");
print textfield({-name=>'query',
-size=>200}), "\n";
print label("maxHits: ");
print textfield({-name=>'maxHits',
-size=>200}), "\n";
print br(), "\n";
print submit({-name=>'submit',
-value=>'Submit'}), "\n";
print end_form, end_html
XML file:
<?xml version="1.0" encoding="UTF-8"?>
<result>
<query id="192448">Aderghal*</query>
<status code="200">OK</status>
<time unit="msecs">1.15</time>
<completions total="1" computed="1" sent="1">
<c sc="5" dc="5" oc="5" id="19115731">aderghal</c>
</completions>
<hits total="5" computed="5" sent="5" first="0">
<hit score="1" id="80402">
<info><authors><author>Karim Aderghal</author><author>Alexander Khvost
+ikov</author><author>Andrei Krylov</author><author>Jenny Benois-Pinea
+u</author><author>Karim Afdel</author><author>Gwenaelle Catheline</au
+thor></authors><title>Classification of Alzheimer Disease on Imaging
+Modalities with Deep CNNs Using Cross-Modal Transfer Learning.</title
+><venue>CBMS</venue><pages>345-350</pages><year>2018</year><type>Conf
+erence and Workshop Papers</type><key>conf/cbms/AderghalKKBAC18</key>
+<doi>10.1109/CBMS.2018.00067</doi><ee>https://doi.org/10.1109/CBMS.20
+18.00067</ee><url>https://dblp.org/rec/conf/cbms/AderghalKKBAC18</url
+></info>
<url>URL#80402</url>
</hit>
</hits>
</result>