in reply to Replace xml first id

If you want details of an attribute then you need to invoke the appropriate method such as XML::LibXML::Node->attributes.

#!/usr/bin/env perl use strict; use warnings; use XML::LibXML; my $dom = XML::LibXML->load_xml (string => <<'EOT'); <?xml version="1.0"?> <header> <idset id="100"> <a>item_a</a> <b>item_b</b> </idset> </header> EOT my $object11 = $dom->findnodes ('/header/idset'); my @attrs = $object11->shift->attributes; print "@attrs\n";

You will see in this example how I have incorporated the XML data into the body of the script which turns it into an SSCCE. That's what you should be doing when posting here (in addition to posting in the right section, of course).

See also: XML Technologies