foreach my $xml_file (@dipfile) { my $ref = XML::Simple::XMLin($xml_file, SuppressEmpty => ''); my ($default_name) = $ref->{defaultName}; my ($doc_type) = '1'; my ($default_description) = $ref->{defaultDescription}; my ($report_time) = $ref->{reportExecutionTime}; my ($reportSearchPath) = $ref->{reportSearchPath}; #Example of data in XML field /content/folder[@name='Opertations']/report[@name='Daily Deposit Correction'] my $temp = substr($reportSearchPath,22,11); if (substr($reportSearchPath,24,11) eq 'Operations') { $doc_type = 2; }