hello I am trying to parse my xml file which looks like below. its a test case structure. each test case can have multiple actions.
<Testsuite> <TestCase > <Action run_cmd=" " Args="@arr1 <%22+args=...@arr1>" Prompt="ok" Ret_values="reference1"></Action> <Action run_cmd=" " Args="@arr2 <%22+args=...@arr2>, $ref1" Prompt="ok" Ret_values="reference2"></Action> </TestCase> <TestCase> <Action run_cmd=" " Args="@arr1 <%22+args=...@arr1>," Prompt="ok" Ret_values="reference2"></Action> </TestCase> <TestCase> <Action run_cmd=" " Args="@arr1 <%22+args=...@arr1>" Prompt="ok" Ret_values="reference2"></Action> </TestCase> </Testsuite> the code i could write to parse is below... i am new to perl. #!/usr/bin/perl use Net::Telnet; use Expect; use XML::Simple qw(:strict); use Data::Dumper; my $file = 'myfile.xml'; my $Action = XMLin($file,ForceArray => 1, KeyAttr => {},); print Dumper($Action); foreach my $Action (@{$TestCase->{Action}}){ my $run_cmd = $Action->{run_cmd}[0]; my $Args = $Action->{Args}[0]; print "$run_cmd \n"; } and i see o/p as below. i get arrays of actions but not the arrays of Test Case from my xml. Is there any way to retrieve the array of Test Cases. please help. $VAR1 = { 'TestCase' => [ { 'Action' => [ { 'Ret_values' => 'reference1', 'Prompt' => 'ok', 'Args' => '@arr1', 'run_cmd' => ' ' }, { 'Ret_values' => 'reference2', 'Prompt' => 'ok', 'Args' => '@arr2, $ref1', 'run_cmd' => ' ' } ] }, { 'Action' => [ { 'Ret_values' => 'reference2', 'Prompt' => 'ok', 'Args' => '@arr1,', 'run_cmd' => ' ' } ] }, { 'Action' => [ { 'Ret_values' => 'reference2', 'Prompt' => 'ok', 'Args' => '@arr1', 'run_cmd' => ' ' } ] } ] }; thanks, vy