use XML::Simple; use Data::Dumper; my $cfg = XMLin('aircracker.conf'); sub getcfg { my $value = shift; if ($value eq 'daemon') { return $cfg->{config}{system}{daemon}; } } print Dumper($cfg); print getcfg('daemon');