Help for this page

Select Code to Download


  1. or download this
    use warnings;
    use strict;
    ...
    $_->[1] =~ s/\W+//g for @ids2text;
    
    print join ", ", map sprintf("%s=%s", @$_), @ids2text;
    
  2. or download this
    my @ids2text = map { [ $_->getAttribute('id'), $_->textContent ] }
        $doc->findnodes(q{//div[@class='data']});
    
  3. or download this
    my $xpc = XML::LibXML::XPathContext->new($doc);
    $xpc->registerNs('html', 'http://www.w3.org/1999/xhtml');
    my @ids2text = map { [ $_->getAttribute('id'), $_->textContent ] }
        $xpc->findnodes(q{//html:div[@class='data']});