#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; use XML::DOM; my $parser = 'XML::DOM::Parser'->new; my $doc = $parser->parsefile(shift) or die $!; my $config = $doc->getElementsByTagName('config'); my $config_attr = $config->[0]->getAttribute('logdir'); say $config_attr;