#!/usr/bin/perl use strict; use XML::Simple; use Data::Dumper; my $xmlConf = "file.xml"; my $conf = new XML::Simple(NoAttr => 1, KeyAttr => [], ForceArray => [qw(box1 box2)], KeepRoot => 1, SearchPath => "." ); my $confIn = $conf->XMLin("$xmlConf"); my $confOut = $conf->XMLout($confIn, OutputFile => $xmlConf); print "Box 1: Username - $confIn->{conf}->{Box1}[0]->{username}, Password - $confIn->{conf}->{Box1}[0]->{password}\n"; print "Box 2: Username - $confIn->{conf}->{Box2}[0]->{username}, Password - $confIn->{conf}->{Box2}[0]->{password}\n"; my $epoch = time(); $confOut->{conf}->{lastRun} = $epoch;