##Creating object for xml file my $xmls = XML::Simple->new( RootName => 'POWERMART', KeepRoot => 1, ForceContent => 1, ForceArray => ['SOURCE'] ); my $contents = {}; $contents->{POWERMART}->{creattion_date} = '02/08/2012'; ##Generate the xml file my $xmlFile = "test.xml"; $xmls->XMLout( $contents, xmldecl => ''."\n".'', OutputFile => $xmlFile );