use XML::LibXML; my $file = '00000002.TIF.xml'; my $xp = XML::LibXML::XPathContext->new( XML::LibXML->load_xml(location => $file), ); $xp->registerNs(b => 'http://zbar.sourceforge.net/2008/barcode'); my $barcode_code39 = $xp->find('/b:barcodes/b:source/b:index/b:symbol[@type="CODE-39"]/b:data'); my $barcode_qrcode = $xp->find('/b:barcodes/b:source/b:index/b:symbol[@type="QR-Code"]/b:data'); $barcode_code39 = substr($barcode_code39, 0, 10); print ("Code 39: ", $barcode_code39, "\n"); print ("QR-Code: ", $barcode_qrcode, "\n");