use 5.010; use strict; use warnings; use LWP::Simple; use XML::LibXML; use constant { URL_TEMPLATE => 'http://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=%s&mt=8', APPLE_ITEMS_NS => 'http://www.apple.com/itms/' }; # Get application ID from command line or use default my $appid = $ARGV[0] // '321234472'; # Create XML parser object and XPath context my $libxml = XML::LibXML->new(); my $xpath = XML::LibXML::XPathContext->new(); $xpath->registerNs(itms => APPLE_ITEMS_NS); # Format URL using template and application ID, load content and parse XML my $document = $libxml->parse_string(get(sprintf(URL_TEMPLATE, $appid))); # Extract all -tags from the XML data my @bs = $xpath->findnodes('//itms:b', $document); # Print the text contained in the extracted tags say $_->textContent foreach (@bs);