0123456 AAA 01234 #### use strict; use warnings; use xml::twig; use utf8; my $file= "itemsANDstuff.xml"; my $twig_handlers = {oa:ItemID[my @agencyRole='Prefix_Number']=> \&ITEMnumber}; my $twig= new XML::Twig(TwigRoots => {'us:ItemMasterHeader' => 1}, TwigHandlers => $twig_handlers); $twig->parsefile($file); sub ITEMnumber{ my ($twig, $Item)= @_; my $prefix=($Item->first_child->text); my $stock = (next_sibling->first_child->text); my $itemNUMBER = $prefix.$stock; print "$itemNUMBER \n";}; #### my $twig_handlers = {oa:ItemID[my @agencyRole='Prefix_Number']=> \&ITEMnumber};