After parsing an XMl file i get the Data:Dumper output as
$VAR1 = { 'xmlns:xsi' => http://www.w3.org/2001/XMLSchema-instance', 'EmployeeTemplate' => { 'Details' => { 'Age' => [ ' 26', ' 28' ], 'Company' => [ ' IBM', ' Oracle' ] }, 'Employee' => { 'EMP_NO' => [ ' 001', ' 002' ], 'EMP_NAME' => [ ' A', ' B' ] }, 'Workprofile' => { 'Designation' => [ ' Systems Analyst', ' Software Engineer' ], 'Experience' => [ ' 2', ' 4' ] } } }; I need to print the output as 001,A,26,IBM,Systems Analyst,2 002,B,28,Oracle,Software Enginner,4 I could access the array values for keys(Experience etc...) using the code below ============================================= #!usr/local/bin/perl # use module use XML::Simple; use Data::Dumper; # create object $xml = new XML::Simple; # read XML file my $data = $xml ->XMLin("myxml.xml"); # print output print Dumper($data); foreach $key(keys % {$data}) #This is for Emplyee etc.. { #This is at level 'Details ' etc ... foreach $subkey(keys % {${$data}{$key}}) { foreach $subsubkey(keys %{$ {$data}{$key}{$subkey} }) { @[EMAIL PROTECTED]; # Get length of the array $len = @array; if ($len == 0) { print "${$data}{$key}{$subkey}{$subsubkey}\n"; } else { for($i=0;$i<$len;$i++) { print "$array[$i]\n"; } } } } } ================================================== This code gives me 26 28 IBM Oracle 001 002 A B Systems Analyst Software Engineer 2 4 ________________________________________________________________________ Yahoo! India Matrimony: Find your partner online. http://yahoo.shaadi.com/india-matrimony/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>