Quantcast
Channel: unable to access hash of array element created using XML parser - Stack Overflow
Viewing all articles
Browse latest Browse all 2

unable to access hash of array element created using XML parser

$
0
0

My XML Parser looks as below:

$VAR1 = {'Symmetrix' => {'Masking_View' => {'View_Info' => {'Initiators' => {'user_node_name' => ['5001438001725614','5001438001725714'                    ],'user_port_name' => ['5001438001725614','5001438001725714'                    ],'wwn' => ['5001438001725614','5001438001725714'                    ]                },'port_grpname' => 'PG_1E0_2E0'            }        },'Symm_Info' => {'symid' => '000295900074'        }    }};

I am trying to pull element of wwn. But I'm not able to get through.

#!C:\Perl\binuse strict;use XML::Simple;use Data::Dumper;my $input_file = $ARGV[0];my $detail_info = XMLin("$input_file");# Loop through each view_info$detail_info->{Symmetrix}{Masking_View}{View_Info} = [ $detail_info->{Symmetrix}       {Masking_View}{View_Info} ] if ref ($detail_info->{Symmetrix}{Masking_View}{View_Info})   ne 'ARRAY';foreach my $view_info  (@{$detail_info-> {Symmetrix}{Masking_View}{View_Info}}){      $view_info->{Initiators} = [$view_info->{Initiators}] if ref ($view_info->    {Initiators}) ne 'ARRAY';foreach my $wwn (keys %{$view_info->{Initiators}})    {     my @flags = ();     push (@flags,"$wwn:$view_info->{Initiators}{$wwn}";     print @flags;     #"{$wwn->{wwn}}";    }}    

I am getting output as below;

{ARRAY(0x20c8904)}

I am looking for wwn element in single line of different line.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images