use warnings; use strict; use Data::Dumper; use XML::LibXML; my $parser = XML::LibXML->new; my $doc = $parser->parse_file( 'practice.xml' ); my $xpath1 = '/quotelist/quotation[source = "Thomas Jefferson"]/@style'; my $result1 = $doc->find( $xpath1 ); print Dumper $result1->string_value; my $xpath2 = '/quotelist/quotation[@id="q5"]/source/text()'; my $result2 = $doc->find( $xpath2 ); print Dumper $result2->string_value; exit 0; #### $VAR1 = 'political'; $VAR1 = 'Thomas Jefferson';