use XML::Simple; my $options = XMLin ('teams.badDB') if -e 'teams.badDB'; # do stuff with $options $options->{'time'} = 15 * 60 if ! exists $options->{'time'}; $options->{'width'} = 200 if ! exists $options->{'width'}; # ... open outFile, '>', 'teams.badDB'; print outFile XMLout ($options); close outFile;