test.xml - - - use XML::Simple; $inst_set= XMLin($file); foreach my $Channel(@{$inst_set->{Channels}->{Channel}}){ if($Channel->{Voltage}){$settings_file=$file} #if the Voltage exists, it must be the settings file } }