http://www.perlmonks.org?node_id=939176

veerubiji has asked for the wisdom of the Perl Monks concerning the following question:

Hi I am getting error while running perl script "can't call method "findnodes" on an undefined value at c:\work\pm.line 17".My script as shown below.

#!/usr/bin/perl use warnings; use strict; use XML::LibXML; my @xml_files = File::Find::Rule->file->maxdepth(1)->name('*dtc.xml')- +>in( "c:/file/save"); my $bigXML = XML::LibXML::Document->new( '1.0', 'UTF-8'); my $aggregated; for my $xml_file ( @xml_files ) { my $doc = XML::LibXML->new->parse_file( $xml_file ); my ( $specNode ) = $doc->findnodes( '//Specification' ); if ( $aggregated ) { $aggregated = $specNode; } else { my @details = $specNode->findnodes( './Definition' ); $aggregated->addChild( $_ ) foreach @details; } } $bigXML->adoptNode( $aggregated ); $bigXML->toFile( 'aggregated_data.xml' );

I Modified above code like that and this time it gives diffrent error like "XML::LibXML::Document::adoptNode()--node is not a blessed SV reference at c:\work\pm.line 17 " help me with this error I didn't see this type of error befor.